[SDL] reRE: [OT] RE: [SDL] Windows version...

Mattias Engdegård f91-men at nada.kth.se
Wed Aug 8 11:34:01 PDT 2001


"Mark Collins" <m.collins at codeplay.com> wrote:
>> >extern DECLSPEC <function> (Not ANSI)
>
>I don't mean DECLSPEC as such, just the whole statement. extern isn't
>needed, and causes problems on strict compilers.

What compilers? It is perfectly legal C. Read the Standard, sections
6.2.2 and 6.9 if you don't believe me.

Note that a strictly conforming compiler is allowed to warn about
anything, as long as it still compiles a program if the latter is correct.
It can complaing about your indentation style, music taste, or just that
it's Thursday.

>We spent quite a bit of time searching through the ANSI C specs (as you can
>imagine, we do have them on hand). The spec doesn't actually say it's
>illegal, but it doesn't say it's legal either...

It does say it's legal. It follows logically from the standard definitions.
I have already quoted chapter and verse; you should be able to read for
yourself.

>It's illegal in C++ because it can cause execution to change scope without
>constructing, and C++ guarentees that everything is constructed. It might
>compile, but it shouldn't.

Again, quote relevant part of the C++ standard. There is no scope
problem; nothing is declared. In fact, I just found Duff's Device in
Bjarne Stroustroup's _The C++ Programming Language_, 3rd ed.

Also, the first thing you find when you google for Duff's Device is
http://www.lysator.liu.se/c/duffs-device.html, which you no doubt have
read.





More information about the SDL mailing list