BUGFIX: TORTURE.C - Fixes to allow builds with Compaq C

John E. Malmberg malmberg at Encompasserve.org
Tue Jul 10 14:41:09 GMT 2001


On Tue, 10 Jul 2001, Michael Sweet wrote:

> "John E. Malmberg" wrote:
> > ...
> > (Not being a language lawyer, I could be wrong on this, but as far as I can
> >  tell from my references, it appears that these changes are needed.)
> > ...
> 
> First, a C compiler should not error out from passing a pointer of
> a different type - such strictness is reserved for C++ compilers... :)

The difference is significant, and while it may be possible to tell
the C compiler to ignore the issue, I would think that most programmers
would want to realize that the what they asked for is obviously not
what they wanted.  This shows up when the pointer is passed to a routine.

Having a volatile pointer is quite a different thing from having a
pointer to a volatile memory location.

> Second, the volatile modifier is not supported by most compilers.
> It is fairly new so I wouldn't recommend using it until more compilers
> support it (and even then you should #define it away if the compiler
> doesn't support it)

Using the #define in config.h may be a good idea, but the implications
of what volatile means to a compiler indicates that it should be used
where ever it is needed.

This would be in any case where the same physical memory location can be
referenced by multiple threads or processes.  Failure to do so can result
in the compiler missing a change to the value.


I have not examined the code to verify if volatile is really needed for 
the code in question.

At this point I am trying to get to the state where I, and hopefully a
few others can build the current CVS tree on OpenVMS.


-John
wb8tyw at qsl.network
Personal Opinion Only





More information about the samba-technical mailing list