BUGFIX: TORTURE.C - Fixes to allow builds with Compaq C
mike at easysw.com
Tue Jul 10 16:30:30 GMT 2001
John Aldridge wrote:
> No... it's an error. ANSI C says (under Assignment)
> "One of the following shall hold... both operands are pointers to qualified
> or unqualified versions of compatible types, and the type pointed to by the
> left hand side has all the qualifiers of the type pointed to by the right."
> and then defines argument passing to be "as if by assignment".
Sigh... You might also look to see that "signed" and "unsigned" types
are considered to be compatible for assignment purposes, although a
compiler is free to issue a warning about it...
> Um, it's in ANSI C, which dates from 1989 (and was commonly supported
> before that). That's not very recent. I haven't seen a compiler which
> didn't support it for many years.
OK, maybe I'm confusing this with the "restrict" keyword...
> Are you thinking of the C9X "restrict" qualifier?
Yes, I think I am. Sorry...
> ANSI C says "An object that has volatile-qualified type may be modified in
> ways unknown to the implementation or have other unknown side effects." ,
> and, in a footnote, "The volatile declaration may be used to describe an
> object corresponding to a memory-mapped input/output port or an object
> accessed by an asynchronously interrupting function."
Right, but that doesn't mean you can use volatile instead of the
OS MP mechanisms. It only tells the compiler not to do certain
optimizations (like caching the results of a dereference)
In short, it sounds like Compaq C may be performing optimizations that
Michael Sweet, Easy Software Products mike at easysw.com
Printing Software for UNIX http://www.easysw.com
More information about the samba-technical