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
