ANSI C -> non-ANSI C

Roy Amodeo amodeo at dataco.UUCP
Wed Dec 5 12:47:21 AEST 1990


In article <2880 at lupine.NCD.COM> rfg at NCD.COM (Ron Guilmette) writes:
>
>What I have always planned on doing (if I ever get the time) is to simply
>add another (optional) warning to GCC which would warn you about all
>actual parameters to (prototyped) functions which get an implicit change
>of representation by virtue of being passed into a formal parameter of
>a sufficiently different type to require such a change of representation.
>Then the programmer could edit his/her own code (adding explicit type
>casts as necessary) until all of these warnings went away.  At that point,
>unprotoization could be done safely.

The cross-compiler we bought for our development work does this. When you
first kick this in, people grumble and complain loudly. They eventually
add casts to make the noise go away. And sometimes they find that they
had arguments in the wrong order or that they were feeding a routine
the wrong data. I would suggest that if you do put in this warning,
make it the default. If you *must*, allow a user to turn it off with a
command line option. This kind of thing goes well with warnings about
calling functions with no prototypes. But then, I'm the weak-memoried
type that strong typing was meant for.

>Here is a better example of the problem:
>
>		extern f (double);
>
>		... f (3); ...
>
I don't suppose you can say
		3d or 3.0L
for
		(double)3
can you? That would be a little less obnoxious.

rba iv	- a foolish signature is the hobgoblin of little minds
nrcaer!dataco!amodeo



More information about the Comp.lang.c mailing list