Re: Automatically generate variables
- From: Yevgen Muntyan <muntyan.removethis@xxxxxxxx>
- Date: Sun, 25 Feb 2007 03:05:52 GMT
Mark McIntyre wrote:
On Fri, 23 Feb 2007 21:22:14 GMT, in comp.lang.c , Yevgen Muntyan
<muntyan.removethis@xxxxxxxx> wrote:
In case of original program using windows.h
you *do* know what windows.h is, and you do know that's a C program.
This is where I disagree fairly strongly, and I've given evidence to
back my position elsethread, and a bit more below.
Evidence of what, that you didn't know what windows.h was? You did
say there are many windows.h headers, and I am still claiming you
knew very well that windows.h in JN's code was the windows api
header. I can't prove it of course, and you can tell I am wrong,
sure.
If you don't know what windows.h was, you can ask.
see below !
I was talking about programs which have 100% C code. Using non-standard
features like "libraries" though.
unless the header for the library is entirely valid C, the programme
isn't strictly a C programme any more. The difficulty is that many
libraries of the type of win32, posix, curses etc do rely on
nonstandard and often downright inadmissible functionality.
Come on, standard headers use same non-standard stuff. They are
protected by the standard which says "you don't care what's inside
the string.h", but nevertheless implementation is also free to
use any non-standard stuff in its own headers. windows.h is part
of particular implementation.
Take a look at glibc headers. string.h and regex.h are no different
in what's inside. Same load of __foobar and __attribute__. So a
program using <regex.h> isn't C, right?
For example, the Windows.h that came with MSVC 6.0 contains a 79
illegal or erroneous constructs eg:
winnt.h(357) : error C2467: illegal declaration of anonymous 'struct'
winnt.h(1519) : error C2054: expected '(' to follow '_inline'
winnt.h(1519) : error C2085: 'GetFiberData' : not in formal param list
winnt.h(1519) : error C2143: syntax error : missing ';' before '{'
winnt.h(4357) : error C2467: illegal declaration of anonymous 'union'
You snipped some stuff, didn't you? C and C++ compilers are famous
by very sane error messages which follow the first, real one.
and even this gem:
cguid.h(54) : warning C4179: '//*' : parsed as '/' and '/*'
cguid.h(124) : fatal error C1071: unexpected end of file found in
comment
which is schoolboy error of hilarious proportions.
Sure, MS makes schoolboy errors. Man, take any standard headers
of any implementation, and try to use them with another implementation
which wasn't intentionally made compatible with the first one (like
icc which pretends it's gcc, or like mingw which is both gcc and
accepting-windows-headers).
I did *not* say the program was strictly conforming. It surely
was not portable. You illustrate its non-portability by trying
to compile something which isn't intended to be compiled in
the way you did it. But why? It's non-portable from the start,
simply because it uses non-standard header.
Let's look at another thing, here on my linux:
muntyan@munt10:/tmp$ cat file.c
#include <windows.h>
int main(void)
{
return 0;
}
muntyan@munt10:/tmp$ gcc -I/usr/i586-mingw32msvc/include/ file.c
muntyan@munt10:/tmp$ icc -X -I/usr/i586-mingw32msvc/include/ -I/usr/lib/gcc/i586-mingw32msvc/3.4.5/include/ file.c
muntyan@munt10:/tmp$
See, it does compile. Mingw has nice headers and Microsoft has
shitty headers which work only with their compiler? Perhaps. So what?
We are not discussing quality of microsoft implementation,
we are discussing a C program which uses that silly windows
api. It's the *same program*, and it is a *C program*. Note I am
not claiming it's a portable program because I can compile
it or something; I am not using your "oops I made it not compile"
trick, just demonstrating that your demonstration was nothing.
Any not strictly conforming program can fail to compile with
some compiler (just by definition), and you showed it. So?
Yevgen
.
- Follow-Ups:
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- From: Kenny McCormack
- Re: Automatically generate variables
- References:
- Re: Automatically generate variables
- From: Yevgen Muntyan
- Re: Automatically generate variables
- From: santosh
- Re: Automatically generate variables
- From: Ian Collins
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- From: Yevgen Muntyan
- Re: Automatically generate variables
- From: CBFalconer
- Re: Automatically generate variables
- From: Yevgen Muntyan
- Re: Automatically generate variables
- From: Richard Bos
- Re: Automatically generate variables
- From: Yevgen Muntyan
- Re: Automatically generate variables
- From: Richard Bos
- Re: Automatically generate variables
- From: Yevgen Muntyan
- Re: Automatically generate variables
- From: Flash Gordon
- Re: Automatically generate variables
- From: Yevgen Muntyan
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- Prev by Date: Re: Requesting advice how to clean up C code for validating string represents integer
- Next by Date: Shorter Articles are better (was: Requesting advice how to clean up C code for validating string represents integer)
- Previous by thread: Re: Automatically generate variables
- Next by thread: Re: Automatically generate variables
- Index(es):