This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fwd: Re: free() and implicit conversion to a function pointer (was: Use of initialized variable in strtod.c)


>> The reason this is wrong is that C by design treats data and functions
>> as living in separate realms, i.e. its virtual machine has a Harvard
>> architecture.  One of the consequences of this is that pointers to
>> functions and pointers to data are incommensurable, i.e. any and all
>> conversions or comparisons across this divide are wrong.  (void *) are
>> compatible to all data pointers, but not to function pointers.
>
> That's true of strict C99, but not true of POSIX (which adds the
> additional requirements above-and-beyond C99 that NULL be equivalent to
> ((void*)0) and that any function pointer can be converted to void* and
> back without loss of information, in part because of dlsym() and friends).
>
> Then again, not all newlib targets aim for POSIX compliance, and it is
> entirely feasible that someone is trying to use newlib to achieve C99
> compliance without caring about additional POSIX requirements.

+1. When I test for compatibility or ST&E, then I will test some
stated features even if I don't use them. -std=c99, -ansi and
_XOPEN_SOURCE are usually easy enough to test.

(Newlib confounds me at the moment, though. I have not figured out an
easy way to test it).

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]