Mail Archives: djgpp/1996/11/14/10:37:38
At 17:52 13/11/96 +0200, Eli Zaretskii wrote:
>
>On Wed, 13 Nov 1996, Ole Winther wrote:
>
>> I really dont know how I can assign value's to the NULL pointer, can someone
>> describe how this can be done?
>
>The most frequent case is when you declare a pointer which is a global
>variable (and is therefore initialized to zero even if you didn't give it
>any value), then use it before assigning any value to it. Example:
>
> char *ptr; /* will be initialized to zero by the linker */
>
> void myfunc(void)
> {
> char c = *ptr; /* this will crash your program under DJGPP */
> }
Eli, this code fragment compiled w/DJGPP (albeit replacing myfunc by main
straight) runs w/o problems!
I'm afraid that only assignments are forbidden, dereferencing (though I
agree that point to a coding error as well are allowed).
[snipped]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak E-mail: csrabak AT ipt DOT br
DME/ASC Phone: 55-11-268-35221Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax: 55-11-268-5996
Av. Prof. Almeida Prado, 532. Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Raw text -