Hello Maarten,

I went through my program for the 8051 and split every one of the headers into 
a header.h with declarations and a source.c with all the code.  I had to add 
'extern' in many of the files.  Now the memory map has sections from a through 
g, and all of the gaps are filled up.

I'll certainly remember this lesson in proper style!  Thank you for taking the 
time to correct my misunderstanding about headers and source.  

Rich.

--- On Mon, 10/29/12, Maarten Brock <[email protected]> wrote:

> From: Maarten Brock <[email protected]>
> Subject: Re: [Sdcc-user] About "memory gap" between register file and 
> bit-variables (MSC-51).
> To: [email protected]
> Date: Monday, October 29, 2012, 12:19 PM
> Hi Rich,
> 
> > Placing the variable definition in a source.c file
> instead of in a
> > header.h file works very nicely to fill in the memory
> 'gap'.
> >
> > Placing the variable definition in a header.h file does
> not fill in the
> > 'memory gap'.
> 
> Of course it doesn't. Only .c files are compiled into an
> object and it's
> actually per object file that the linker places the memory
> segments.
> 
> >> From what I've read on the internet about the topic
> of how and when to
> >> use header files and source files, it would seem
> that placing a global
> >> variable in a header or in a source file should not
> make much difference.
> 
> Placing variable definitions in a header file is a very bad
> programming
> style and should be avoided at all times. Only place
> declarations in
> header files.
> 
> >>  I would assume that SDCC is fully ANSI C
> compliant in this area.
> 
> SDCC will give an error when you try to compile a header
> file with:
> sdcc -c header.h
> 
> > In this case, with SDCC compiling for an 8051, it makes
> a big difference.
> > Being able to use that block of 24 bytes of ram, will
> really help.  I'm
> > guessing that allocating bytes of ram based on source.c
> files is not even
> > mentioned in ANSI C!  I couldn't find anything in
> the SDCC manual on this
> > topic.
> >
> > Thanks,  Rich.
> 
> Maarten
> 
> ------------------------------------------------------------------------------
> The Windows 8 Center - In partnership with Sourceforge
> Your idea - your app - 30 days.
> Get started!
> http://windows8center.sourceforge.net/
> what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
> _______________________________________________
> Sdcc-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
> 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to