summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
63972d0)
variables, bit parameter passing, the need for function pointers to be
reentrant and alpha quality support of inline and retrict
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4818
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2007-05-29 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * doc/sdccman.lyx: documented initialization and allocation of absolute
+ variables, bit parameter passing, the need for function pointers to be
+ reentrant and alpha quality support of inline and retrict
+
2007-05-26 Borut Razem <borut.razem AT siol.net>
* support/regression/tests/bug1057979.c, support/regression/tests/malloc.c,
2007-05-26 Borut Razem <borut.razem AT siol.net>
* support/regression/tests/bug1057979.c, support/regression/tests/malloc.c,
-#LyX 1.4.4 created this file. For more info see http://www.lyx.org/
+#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
\lyxformat 245
\begin_document
\begin_header
\end_inset
) are good places to look for such overlaps.
\end_inset
) are good places to look for such overlaps.
- Variables with an absolute address are
-\emph on
-not
-\begin_inset Marginal
-status collapsed
-
-\series bold
-\InsetSpace ~
-!
-\end_layout
+If however you provide an initializer
+\begin_inset LatexCommand \index{Variable initialization}
+ actual memory allocation will take place and overlaps will be detected
+ by the linker.
+ E.g.:
+\end_layout
-\emph default
- initialized
-\begin_inset LatexCommand \index{Variable initialization}
+\family typewriter
+__code __at (0x7ff0) char Id[5] =
+\begin_inset Quotes sld
+SDCC
+\begin_inset Quotes srd
+\end_inset
+
+;
+\end_layout
+
+\begin_layout Standard
+In the above example the variable Id will be located from 0x7ff0 to 0x7ff4
+ in code memory.
\end_layout
\begin_layout Standard
\end_layout
\begin_layout Standard
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
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).
+ RAM (for small model) or external RAM (for medium or large model).
This in fact makes them similar to
\emph on
static
This in fact makes them similar to
\emph on
static
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
\InsetSpace ~
-0003$: ;label (can be referenced by inline assembler only)
-
+0003$: ;label (can be referenced by inline assembler only)
\newline
\InsetSpace ~
\InsetSpace ~
\newline
\InsetSpace ~
\InsetSpace ~
- to pass the first parameter to a function, and also to pass the return
- value
+ to pass the first (non-bit) parameter to a function, and also to pass the
+ return value
\begin_inset LatexCommand \index{return value}
\end_inset
\begin_inset LatexCommand \index{return value}
\end_inset
\end_inset
-stack-auto is used) or in data/xdata memory (depending on the memory model).
\end_inset
-stack-auto is used) or in data/xdata memory (depending on the memory model).
+\end_layout
+
+\begin_layout Standard
+Bit parameters are passed in a virtual register called 'bits' in bit-addressable
+ space for reentrant functions or allocated directly in bit memory otherwise.
+\end_layout
+
+\begin_layout Standard
+Functions (with two or more parameters or bit parameters) that are called
+ through function pointers
+\begin_inset LatexCommand \index{function pointers}
+
+\end_inset
+
+ must therefor be reentrant so the compiler knows how to pass the parameters.
\end_layout
\begin_layout Subsection
\end_layout
\begin_layout Subsection
\family typewriter
foo(i,j) /* this old style of function declarations */
\newline
\family typewriter
foo(i,j) /* this old style of function declarations */
\newline
in ANSI but not valid in SDCC */
\newline
{
in ANSI but not valid in SDCC */
\newline
{
\end_deeper
\begin_layout Itemize
\end_deeper
\begin_layout Itemize
-Most enhancements in C99 are not supported, f.e.:
+Most enhancements in C99 are not supported, e.g.:
+\end_layout
+
+\begin_deeper
+\begin_layout Verse
+
+\family typewriter
+for (
+\series bold
+int
+\series default
+ i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+But some have been added recently in SDCC 2.7.0.
+ They must be considered alpha quality however.
\end_layout
\begin_deeper
\end_layout
\begin_deeper
- int increment (int a) { return a+1; } /* is invalid in SDCC although allowed
- in C99.
- An empty define
-\emph on
-#define inline
-\emph default
- can be used as a work around */
-\newline
-
+ int increment (int a) { return a+1; } /* inlines the increment without
+ function call overhead */
+restrict
+\begin_inset LatexCommand \index{inline (not supported)}
+
+\end_inset
+
+
- i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */
+ p; /* accepted but ignored */