On Wednesday 24 February 2010 00:32:53 [email protected] wrote:
> Rob Landley wrote:
> > On Tuesday 23 February 2010 12:02:55 Timo wrote:
> >> I would say that it is the responsibility of the compiler toolchain to
> >> make sure that static, not-explicitly-initialized variables are cleared
> >> before entry into the 'main'. It is a requirement of the C-language. So,
> >> if the variables are not cleared, the toolchain is horribly broken.
> >
> > (Could you tell me where in the C language speci it's required?  I
> > checked the c99-draft.html I have and couldn't find it, but that doesn't
> > mean much.  It _seems_ like something C99 would require, but I haven't
> > tracked down where yet.)
>
> I have "ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007". There
> "6.7.8 Initialization" paragraph 10 says:
>
> "...
> If an object that has static storage duration is not initialized
> explicitly, then:
>
> — if it has pointer type, it is initialized to a null pointer;
> — if it has arithmetic type, it is initialized to (positive or unsigned)
> zero; ..."
>
> Actually, this was the first time I read it in the standard myself...

Ah, there it is:

  http://busybox.net/~landley/c99-draft.html#6.7.8

Point #10.

Thanks.

Heh, according to that:

  union {
    char one;
    long two;
  }

Then "two" isn't guaranteed to have more than its first byte initialized.  
(Although I suspect some other part of the spec may address that, and I know 
implementations using an ELF bss will...)

I actually read rather a lot of the C99 standard looking for this sort of 
thing back when I was maintaining my own tinycc fork.  I was trying to get the 
sucker to build busybox, uClibc, and the Linux kernel, but every time I put a 
couple months of effort into it the original tcc project would start up again 
and merge about half my changes (but not any of the refactoring/cleanup work I 
was doing, and they kept missing important fixes they "didn't understand".  
Sigh.)  And then I'd stop working on it for 3 months and the original project 
would grind to a halt again.  Really darn frustrating.  (Especially since once 
they'd scraped together enough to put out a release, my tree just couldn't 
compete for attention with the owner of the tinycc.org domain.  I kept getting 
bug reports about the _other_ tree that I'd fixed months if not years 
previously...)

I've ignored it for a couple years now.  I kept hoping the original project 
would die conclusively enough I could restart mine without the zombie lurching 
forward again, but since then the zombie's turned into a windows-only thing, 
which has only mentioned Linux once since New Year's but has two big threads 
this week (each with a half-dozen posts or more) titled "Compile TCC with 
Visual Studio 2005" and "using tcc as a cross compile for Windows"...

*shrug*

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to