Mail Archives: djgpp-workers/1999/07/02/05:13:41
Eli Zaretskii wrote:
>
> On Wed, 30 Jun 1999, Bill Currie wrote:
>
> > > > According to ANSI C, users can legitimately do that, and still assume
> > > > they get a working program.
> >
> > IMHO, broken spec. Nuff said.
>
> This ``broken spec'' has survived for 10 years with virtually no
> changes, C being the most used language all that time.
>
> IMHO, every ruling of the ANSI C standard has very good reason for
> being there.
Sorry, you're right about this, of couse. I was thinking no prototypes
at all. I've had problems with this when sizeof(char*)!=sizeof(int).
> In this case, there are tons of programs out there which
> say things like "char *malloc();" instead of including the header,
> because some old compilers didn't have prototypes for some functions,
> notably those which return an int.
Yes, there are a lot of programs that do that (and need to,
unfortunatly), but as the Ten Commandments of C Programming
(http://www.ee.ryerson.ca:8080/~elf/hack/The10.html) states
(paraphrased): if you do this, KMACYOYO. It's not a safe thing to do
(eg char * vs char far * in 16bit dos compilers) when the calling
convetion can change under your feet. I've been burned by this, so I'm
not just spouting dogma. However, I agree, you *should* be able to do
this safely (gcc's multilibbing should help, but it's expensive).
Bill
--
Leave others their otherness.
- Raw text -