[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libc6-dev and "-pedantic -O" warnings



Steve Greenland wrote:
> 
> On 08-Jun-99, 14:26 (CDT), Shawn Yarbrough <shawn@rivalsoftware.com> wrote:
> > The stupid header is not ANSI compliant, so if you turn on ANSI
> > compilation mode, the header won't compile.  Which means that you can't
> > write ANSI C programs that open windows, at least I couldn't figure out
> > how to do so.  Maybe there is a way, but I don't have time to work
> > around such MS BS.
> 
> ObPedantic: If you are trying to open "window" (whatever that is; my
> copy of the ISO C standard makes no mention of any such thing, or of a
> <windows.h> header file), you've already stepped outside of the bounds
> of ISO C.
> 
> But I understand what you're trying to do: use the MSWindows OS, but
> have the compiler warn about non-ISO language constructs (as opposed
> to library issues). I think you can actually accomplish this, but it
> requires a lot #pragma to activate and deactivate various warnings, and
> isn't worth the effort. A better choice is to run the code through "gcc
> -Wall" (not "--pedantic") on a system with the windows header files
> copied over. You'll still get some flaky warnings, but you'll also pick
> up some of your screw ups.
> 


It sounds like you are saying that an ANSI program (an ISO program???)
can not include headers unless those headers are explicitly defined, by
name, in the ANSI standard.  This seems incorrect... it's quite
reasonable to invent new header files which comply with ANSI.

For example, the <windows.h> file is the standard file that nearly all
programs are expected to include if they are written for MS Windows (for
win32).  It is an MS-defined file.  I don't see why MS can't either
clean up their headers (so that they don't use non-ANSI compiler
features) or at least provide seperate, ANSI-compatible substitutes.

BTW, I experienced this problem with MS Visual C++, not with GCC.  I
mentioned it only as an example of the wrong way to design headers.  The
standard headers need to be ANSI-compliant (not giving spurious
warnings) or at least need to appear to be so.  This applies to all
operating systems (and compilers) and is very important for supporting
portability.

-- 

 -----------------------------------------------------------------
| Shawn Yarbrough               |  Skepticism is healthy; anyone  |
| shawn@rivalsoftware.com       |  claiming otherwise is either a |
| http://www.rivalsoftware.com  |  con artist or a Christian.     |
 -----------------------------------------------------------------


Reply to: