From: Rod B. <ro...@bo...> - 2003-01-27 09:59:55
|
For the life of me I cannot understand why you would want to do something that while the language may support it, it is not good programming habits. If you buy a gun and just because you could shoot your foot off does that mean that you want to shoot your foot off. Don't get me wrong I'm not trying to put anybodies ideas down. I have used goto in C code 3 times in about the last 5 years. I can think up good justifable reasons to break the rules. BUT I would also say that the example was very thin I've never liked globals it is like adding another parameter to every function you write but that parameter is not included in every prototype for each function. You can never tell what is happening to a global variable. Regards, Rod On Sun, 16 Jul 2000 13:20:31 +0530 "Royce & Sharal Pereira" <be...@et...> wrote: > Hi, > ----- Original Message ----- > > Your logic for requesting this is flawed. It has been my experance that > each IIC implementation for a new project is diffrent. For instance On one > --------------------------------------------------------------- > Let me simplify things a bit. > My request has nothing to do with IIC implementation...it was just an > example. > My point was about C language convention. > > All variables declared outside a function are to be made global, if i'm not > mistaken. This is not followed by SDCC in some cases. > > if I say: " bit flg_one ;" outside a function > I get: " .globl flg_one" which is correct. > > but if I say "bit at 0x20 flg_one;" > I do not get ".global flg_one" > while there is basically no difference between the two. > flg_one is not declared global in the second case, while it should be. Can > someone explain why ? I believe that it's just something that's been > overlooked. > > Whereas, If I say: "char value;" or " data at 0x21 char value;" outside a > function, both are interpreted correctly & I get " .global _value;" in both > cases which is what is expected. > > Thats the point I was trying to make :-). Not about a particular function or > anything. > > PS: I found a workaround: > void globals() _naked > { > _asm > .globl _flg_one > .globl _SDA // for example > .globl _SCL > _endasm; > } > This gives me the global attribute for explicitly located bit & sbit > variables. > > Thanks, > --Royce. > > > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > |