Re: [cc65] BSS Segment

Date view Thread view Subject view

From: Groepaz (groepaz_at_gmx.net)
Date: 2003-08-27 07:20:38


On Tuesday 26 August 2003 00:08, Ullrich von Bassewitz wrote:
> Yes, but the thing where most people get a hickup is that
>
>         char* p = 0;
>
> does not assign a bit pattern of all zeroes to p. Instead, "0" is converted
> to the NULL pointer constant of the machine, may it be something consisting
> of all zero bits or not.

mmmmh i see another funny problem here...what if i really want to assign 0 
(and _not_ NULL, whatever bitpattern it is) because i want to use the pointer 
to access the memory at location 0?

something like

int i;
char *p;

	i=0;
	p=(char*)i;

comes to mind, but would that even work as intended? (the compiler might 
optimize out the helper variable, and then again convert the zero to NULL 
when assigning to the pointer)

OR is it so that *(char*)NULL is defined to access memory at location zero? 
(which would again raise the question how to access the memory at that 
certain bitpattern defined as NULL :=P)

:)

gpz

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-08-27 07:24:34 CEST