Re: [cc65] BSS Segment

Date view Thread view Subject view

From: Groepaz (groepaz_at_gmx.net)
Date: 2003-08-27 22:32:02


On Wednesday 27 August 2003 12:05, Andre Majorel wrote:

> A compiler that would represent the null pointer with another bit
> pattern that all zeroes and still do that would be non-conformant. With
> respect to pointers, the integer constant 0 (i.e. the token 0 in the
> source code) is special. The integer value (i.e. an int which compares
> equal to 0) is not.

ahhh yes that makes sence.

> > 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)
>
> I'm not sure I understand your question but... The null pointer might
> not be a valid address at all. On some architectures, attempting to
> dereference a null pointer might cause not just a segfault but a
> CPU-level exception (bus error or something like that).

i am aware of the fact that memory-address zero is "illegal" on a lot of 
architectures, but regardless of that i might still want to use it. (for 
example to trigger an exception on purpose).... however, i'd guess that on 
machines that have NULL defined other than zero, it contains a bitpattern 
that make a _physically_ not available address and so doesnt clash with 
neither the real address zero nor the real address its bitpattern would be 
pointing to.

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 22:38:43 CEST