www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/14/10:37:38

Date: Thu, 14 Nov 1996 15:33:08 -0200
Message-Id: <1.5.4.16.19961114132000.29cf1b84@dmeasc.rc.ipt.br>
Mime-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, Ole Winther <owsim AT ruc DOT dk>
From: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
Subject: Re: How assign to NULL POINTER
Cc: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019