Reshaped doc's
[fw/sdcc] / doc / sdccman.html / node24.html
diff --git a/doc/sdccman.html/node24.html b/doc/sdccman.html/node24.html
new file mode 100644 (file)
index 0000000..0d8c000
--- /dev/null
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+
+<!--Converted with LaTeX2HTML 99.1 release (March 30, 1999)
+original version by:  Nikos Drakos, CBLU, University of Leeds
+* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>3.5 Parameters &amp; Local Variables</TITLE>
+<META NAME="description" CONTENT="3.5 Parameters &amp; Local Variables">
+<META NAME="keywords" CONTENT="sdccman">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<META NAME="Generator" CONTENT="LaTeX2HTML v99.1 release">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="sdccman.css">
+
+<LINK REL="next" HREF="node25.html">
+<LINK REL="previous" HREF="node23.html">
+<LINK REL="up" HREF="node19.html">
+<LINK REL="next" HREF="node25.html">
+</HEAD>
+
+<BODY >
+<!--Navigation Panel-->
+<A NAME="tex2html612"
+ HREF="node25.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
+<A NAME="tex2html606"
+ HREF="node19.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
+<A NAME="tex2html600"
+ HREF="node23.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> 
+<A NAME="tex2html608"
+ HREF="node1.html">
+<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A> 
+<A NAME="tex2html610"
+ HREF="node61.html">
+<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A> 
+<BR>
+<B> Next:</B> <A NAME="tex2html613"
+ HREF="node25.html">3.6 Overlaying</A>
+<B> Up:</B> <A NAME="tex2html607"
+ HREF="node19.html">3. Using SDCC</A>
+<B> Previous:</B> <A NAME="tex2html601"
+ HREF="node23.html">3.4 Pointers</A>
+ &nbsp <B>  <A NAME="tex2html609"
+ HREF="node1.html">Contents</A></B> 
+ &nbsp <B>  <A NAME="tex2html611"
+ HREF="node61.html">Index</A></B> 
+<BR>
+<BR>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00045000000000000000">
+3.5 Parameters &amp; Local Variables</A>
+</H2>
+
+<P>
+Automatic (local) variables and parameters to functions can either
+be placed on the stack or in data-space. The default action of the
+compiler is to place these variables in the internal RAM (for small
+model) or external RAM (for Large model). This in fact makes them
+<I>static</I> so by default functions are non-reentrant.
+
+<P>
+They can be placed on the stack either by using the <I>-stack-auto</I>
+compiler option or by using the <I>reentrant</I> keyword in the function
+declaration, e.g.:
+<BR>
+
+<BR>
+<TT>unsigned char foo(char i) reentrant </TT>&nbsp;
+<BR>
+<TT>{ </TT>&nbsp;
+<BR>
+<TT>... </TT>&nbsp;
+<BR>
+<TT>}</TT>&nbsp;
+<BR>
+
+<BR>
+Since stack space on 8051 is limited, the <I>reentrant</I> keyword
+or the <I>-stack-auto</I> option should be used sparingly. Note that
+the reentrant keyword just means that the parameters &amp; local variables
+will be allocated to the stack, it <I>does not</I> mean that the function
+is register bank independent.
+<BR>
+
+<BR>
+Local variables can be assigned storage classes and absolute addresses,
+e.g.: 
+<BR>
+
+<BR>
+<TT>unsigned char foo() {</TT>&nbsp;
+<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;xdata unsigned char i;</TT>&nbsp;
+<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;bit bvar;</TT>&nbsp;
+<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;data at 0x31 unsiged char j;</TT>&nbsp;
+<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;... </TT>&nbsp;
+<BR>
+<TT>}</TT>&nbsp;
+<BR>&nbsp;
+<BR>
+In the above example the variable <I>i</I> will be allocated in the
+external ram, <I>bvar</I> in bit addressable space and <I>j</I> in
+internal ram. When compiled with <I>-stack-auto</I> or when a function
+is declared as <I>reentrant</I> this can only be done for static variables.
+
+<P>
+Parameters however are not allowed any storage class, (storage classes
+for parameters will be ignored), their allocation is governed by the
+memory model in use, and the reentrancy options.
+
+<P>
+<HR>
+<!--Navigation Panel-->
+<A NAME="tex2html612"
+ HREF="node25.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
+<A NAME="tex2html606"
+ HREF="node19.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
+<A NAME="tex2html600"
+ HREF="node23.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> 
+<A NAME="tex2html608"
+ HREF="node1.html">
+<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A> 
+<A NAME="tex2html610"
+ HREF="node61.html">
+<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A> 
+<BR>
+<B> Next:</B> <A NAME="tex2html613"
+ HREF="node25.html">3.6 Overlaying</A>
+<B> Up:</B> <A NAME="tex2html607"
+ HREF="node19.html">3. Using SDCC</A>
+<B> Previous:</B> <A NAME="tex2html601"
+ HREF="node23.html">3.4 Pointers</A>
+ &nbsp <B>  <A NAME="tex2html609"
+ HREF="node1.html">Contents</A></B> 
+ &nbsp <B>  <A NAME="tex2html611"
+ HREF="node61.html">Index</A></B> 
+<!--End of Navigation Panel-->
+<ADDRESS>
+<I>Johan Knol</I>
+<BR><I>2001-07-13</I>
+</ADDRESS>
+</BODY>
+</HTML>