[comp.lang.c++] machine generated code and chatty compilers

wsmith@mdbs.UUCP (Bill Smith) (01/05/90)

For those helpful souls that wish their C or C++ compiler to generate
helpful warning messages in contexts that are technically correct, I 
have another argument that that is inherently a bad idea.

People are not the only entities that generate code for C or C++ compilers.

It is often very useful for a program to generate code in second phase
By doing this, development time for an application is reduced.
If it is convenient for the pre-processor to generate code that is in a
pattern that is a mistake when done by humans, any warnings in such
context will render the rest of the compiler's error checking useless.
(What happens is the compiler generates hundreds of warnings that get
redirected to /dev/null along with any useful and deserved errors that
were generated.)

As a side note, I think one can show that if you had a fortran program
that generated a second fortran program, the two pass execution model
would have equivalent power to any recursive language.  In other words,
one could guarantee that the generated fortran program would never
has stack overflow, which one could not guarantee in a single fortran
program. :-)

Bill Smith
pur-ee!mdbs!wsmith
(not my employer's opinions)

ewiles@netxdev.DHL.COM (Edwin Wiles) (01/06/90)

In article <1471@mdbs.UUCP> wsmith@mdbs.UUCP (Bill Smith) writes:
>For those helpful souls that wish their C or C++ compiler to generate
>helpful warning messages in contexts that are technically correct, I 
>have another argument that that is inherently a bad idea.
>....{edited for brevity}....
>If it is convenient for the pre-processor to generate code that is in a
>pattern that is a mistake when done by humans, any warnings in such
>context will render the rest of the compiler's error checking useless.

1)	If it's a mistake for a human to do it, then it's a mistake for a
	program to do it.

2)	If it's not a mistake, then don't complain about it.

	(Personally, I consider type-mismatches to be mistakes.  Supposedly
	"safe" mismatches have bitten me too often for me to 'ignore' them
	without careful consideration, and even then I'll typecast rather
	than leave a "mistake".)

3)	Any program smart enough to write code should be smart enough to
	avoid things such as type mismatches.  If it isn't, then fix it!
	"Who?... Me?... WHAT opinions?!?"	| Edwin Wiles
    Schedule: (n.) An ever changing nightmare.	| NetExpress, Inc.
  ...!{hadron,sundc,pyrdc,uunet}!netxcom!ewiles	| 1953 Gallows Rd. Suite 300
       ewiles@iad-nxe.global-mis.DHL.COM	| Vienna, VA 22182

bts@sas.UUCP (Brian T. Schellenberger) (01/07/90)

In article <1471@mdbs.UUCP> wsmith@mdbs.UUCP (Bill Smith) writes:
|People are not the only entities that generate code for C or C++ compilers.

However, they *do* write most of them (maybe not most code, but surely
most programs).  So a good complier should be fairly chatty, especially to
help the poor inocents who are just getting started with C.  Then it should
be easy to turn off the chatiness, both on a single-message basis and by
turning off the whole shootin' match of questionable messages.  Those in
the know will have the werewithall to set up aliases which turn off these
messages all the time; babes in the woods will be saved much grief.

[Lattice compilers, for one (on the Amiga, at least) come pretty close
meeting this ideal, BTW.]  CLAIMER:  I work for Lattice's parent company,
so I may not be objective.
-- 
-- Brian, the Man from Babble-on.		...!mcnc!rti!sas!bts
-- (Brian Schellenberger)
"No one will ever write a song called 'Nitro Burning Funny Cars'"
                 -- THE DEAD MILKMEN, "Nitro Burning Funny Cars"

econrad@thor.wright.edu (Eric Conrad) (01/10/90)

From article <1471@mdbs.UUCP>, by wsmith@mdbs.UUCP (Bill Smith):
> For those helpful souls that wish their C or C++ compiler to generate
> helpful warning messages in contexts that are technically correct, I 
> have another argument that that is inherently a bad idea.
> 
> People are not the only entities that generate code for C or C++ compilers.

So turn the warning suppression flag on for automatic-generated code.

-- Eric Conrad
+----------------------------------------------------------+
| Eric Conrad - Wright State University                    |
| "Progress was all right once, but it went on too long."  |
+----------------------------------------------------------+