Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: gcc question





On Thu, 13 Jan 2000, Fredric Fredricson wrote:

>    You are right that gcc/egcs, or any c compiler for that matter, does not
>    initialize the pointers but Linux will clear all new pages so in this 
>    particular case both pointers will be "initialized" to 0. 
>    It is of course a bug to rely on this but I have seem dozens of 
>    programs that does (probably/hopefully unintentional).
>    
>    From a developers point of view it is a good thing that Linux
>    does not allow access to memory address 0. This way uninitialized

Really? I have never seen that happening though. In my
experience, uninitialized pointers on egcs/Linux do point to arbitrary
locations..

Try this:

int main()
{
  char *c1, *c2, *c3;

  printf("%d %d %d\n", c1, c2, c3); 
  
  return 0;
}  


Selva

-------------------------------------------------------------------
Next Technical Meeting: January 14 (Fri) 19:00
* Topic: "glibc - current status and future developments"
* Guest Speaker: Ulrich Drepper (Cygnus Solutions)
* Place: Oracle Japan HQ 12F Seminar Room (New Otani Garden Court)
-------------------------------------------------------------------
more info: http://www.tlug.gr.jp        Sponsor: Global Online Japan


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links