F
Flash Gordon
Yevgen Muntyan wrote, On 17/03/07 00:04:
I comment on those things I decide to comment on and not on those things
I decide not to comment on. You and everyone else does exactly the same.
You sited what you thought might be a reason and seemed not to accept
that it was an exceedingly bad reason. You still seem not to accept that.
I strongly disagree with the word "good" above. It would be an
incredibly bad reason.
I am saying that if you came across the problem you should take EXACTLY
the attitude I have taken for some library versions and OSs and tell
people it is broken and that if they want to use your code they cannot
use that version of that library.
Since it works for a small company being paid to develop code for far
larger companies I don't see any reason it would not work in other
situations. It has also worked for one developer within a small company
writing code for far larger companies.
Writing code to deal with obscure systems is common, writing code to
deal with broken system libraries is at least extremely unusual.
Providing stndup is *not* a weird anomaly. It is a reserved name so the
library can use it for whatever purpose it wants without breaking
correct code.
If it claims conformance to the C standard then you know it does not.
That is the POINT of having a standard.
No, it is supporting *incomplete* C99 implementations. Since they do not
yet *claim* to be conforming to C99 they are not broken.
I doubt it supports Win64 yet, lots of things don't. However, if it is
well written it is unlikely to be bitten by the one area of
non-conformance that has been identified, and including the headers from
a C implementation on Win64 is not likely to break anything.
It is not inclusion of the standard headers that causes the problem, so
that is not a reason for avoiding including the headers. In fact, if
they used size_t as has been suggested in this thread they should then
it would not cause a problem.
I accept that it is a non-conformance of the 64 bit version of Visual
Studio (A 64 bit implementation of gcc on Win64 could well not be
broken, especially if they ever finish implementing C99).
So that *still* is not a reason to avoid including standard headers and
types, if anything it is an argument *for* using them.
It was also a bug in the C implementation, one that was fixed under
pressure from everyone else not prepared to work around it.
I've not seen mention in the documentation of working around broken
string functions, and I've not come across broken string functions. I
have come across ones that don't meet standard they don't claim to meet,
but that is another story.
Can you give a specific example of where it is working around a broken
string library, as opposed to one that does not meet a standard it does
not claim to meet, or one that is correct but does not provide the
functionality they want?
No, but a bug making avoidance of including standard headers would be
almost as serious since it would break stupidly large amounts of code.
Telling people they have to upgrade to the new fixed version of some
library is COMMON PRACTICE.
I've yet to come across a situation where it was not possible. Where it
was just awkward but not broken I could not argue it, but where it is
broken it is common practice to tell people they have to upgrade.
I am saying that an implementation with headers that were buggy enough
you could not safely include them would not survive. I have said this
several times. This is also why any such broken implementation would not
be a good reason to avoid using broken headers.
The standard headers are *not* so broken you cannot safely include them.
The breakage is of a different type. Also, it is not Win64 but the 64
bit version of Visual Studio.
I mean exactly what I said. It is perfectly safe to include the standard
headers in conforming mode, and if you obey what the documentation tells
you (i.e. use _GNU_SOURCE correctly) it is safe to include them in
non-conforming mode.
I.e. the ONLY time it is NOT safe to include them is when YOU are at
fault. The same applies to authors of libraries. I.e., is is SAFE for
library writers to include standard headers in their headers because
things will only break when YOU do something wrong.
To put it another way, you are WRONG to say that avoiding header bugs
might be a good reason not to include standard headers ANYWHERE.
I use a lot of open source, so I do know how it works. I have also been
on the wrong end of having the open source community NOT support things.
I just passed the lack of support along the line to customers and told
them we could not support it either and if they wanted to use the new
version of get bug fixes they *needed* they would have to upgrade.
Read the bits you have quoted earlier where I EXPLICITLY state that the
same rules apply when using the implementation in NON-conforming mode.
If you use them you have to read the documentation for them as well, and
then YES, you CAN safely include them. I have been using system
specifics and extensions where appropriate since I started programming
professionally over 20 years ago (not in C back then) and it is safe.
Including on the implementations that people seem to me to complain most
about for providing extensions, gcc and MS Visual Studio.
Last I looked string.h *is* a standard header. However, I EXPLICITLY
stated that it is still safe to include it in non-standard conforming
mode (i.e. using _GNU_SOURCE) as long as YOU read the documentation and
so do it correctly.
The STANDARD says that the entry point for YOUR program in a hosted
implementation IS main. If the entry point of YOUR program is NOT main
then either it is NOT a hosted implementation (which is a perfectly
valid thing to be) or it is NOT compliant with the standard.
So if you invoke it so that you do not have to provide main you are NOT
invoking it as a compliant hosted implementation because the STANDARD
says that you have to provide main to a hosted implementation.
See everything I said above. The entry point to YOUR program has to be
main, not the entry point to something that calls your program. This is
because that is what the STANDARD says.
So? You not knowing how to use it does not affect anything I said. MS
having WinMain as the entry point is legal when it is not behaving as a
hosted implementation, so they are fine there. When invoked as a hosted
implementation you have to provide main, so they are still fine.
sys/stat.h is NOT a reason for developers to be wary of standard headers
and nothing you have said justifies your statement that it is. It would
make just as much sense to say the sinking of the Titanic was a good
reason for developers to be wary of standard headers.
Don't you find it at all strange that you seem to be the only person who
thinks it does not work? Have you not considered that people with vastly
more experience might actually have found that compiler writers take
compliance to C89 seriously and take making their C implementations
usable as intended (i.e. including the standard headers) even more
seriously?
There is no evidence that you are not a figment of someone's deranged
imagination either.
Generally in both science and technical arenas the person challenging
what is generally believed has to provide some convincing evidence.
None of the implementations it support claim to be C99 implementations,
therefore working around them not having stdbool.h or not having an
stdbool.h that meets the C99 requirements is NOT working around a broken
implementation, it is working around an implementation being perfectly
correct and not providing what they want.
Where? Working around a non-C99 implementation not providing C99
functionality is NOT working around a broken implementation.
So having said it is an example of your point you now accept my
statement that it is not an example of my point.
Oh, just so you know I've decided that since you seem unable to >
understand the points others and I have made (several times above you
say you don't understand, or close enough) there is no point arguing
further with you. Believe what you will and the rest of us will be happy
knowing that we can always safely include standard headers and use
size_t, even with the small break that MS Visual Studio for Win64, since
that does not break well written code.
Right... You commented on parts you liked,
I comment on those things I decide to comment on and not on those things
I decide not to comment on. You and everyone else does exactly the same.
> and you don't care about
the discussion in whole, where I say one thing and other hears what
he wants to hear. Just like here, you're saying I am claiming there
is a reason not to use standard headers. While I said like five times
that I do *not* know such a reason. Of course, from my unwillingness
to make baseless conclusions you make a conclusion that my opinion
is the contrary. And so on.
You sited what you thought might be a reason and seemed not to accept
that it was an exceedingly bad reason. You still seem not to accept that.
It was a hypothetical good reason for not using standard headers
in general,
I strongly disagree with the word "good" above. It would be an
incredibly bad reason.
> which naturally leads to avoiding #includ'ing stddef.h.
But yes, I do support the following: if an implementation has broken
header foobar.h and I write code for that platform, I will try to work
it around; and if not using foobar.h is a fix, I will avoid using
foobar.h. And *no*, I do not avoid using standard headers in *my*
code because of hypothetical problems.
I am saying that if you came across the problem you should take EXACTLY
the attitude I have taken for some library versions and OSs and tell
people it is broken and that if they want to use your code they cannot
use that version of that library.
Since it works for a small company being paid to develop code for far
larger companies I don't see any reason it would not work in other
situations. It has also worked for one developer within a small company
writing code for far larger companies.
Indeed, that's why we should use standard headers. And? Was it
you agreed or disagreed with my words about making conclusion
without having enough ground?
Writing code to deal with obscure systems is common, writing code to
deal with broken system libraries is at least extremely unusual.
If *I* did, nothing would break. You can prove there are no weird things
in stdio.h like that strndup on every system? You can prove silent
#includ'ing stdio.h will not break user code?
Providing stndup is *not* a weird anomaly. It is a reserved name so the
library can use it for whatever purpose it wants without breaking
correct code.
If it claims conformance to the C standard then you know it does not.
That is the POINT of having a standard.
Yes it does support broken C99 implementations.
No, it is supporting *incomplete* C99 implementations. Since they do not
yet *claim* to be conforming to C99 they are not broken.
> Now you can say
something about C90, that gnulib example is irrelevant since C90
is the important thing, perhaps because C90 is widely implemented
and so on. And we're back to Win64. Oh, totally forgot, it also
supports some broken C90 implementations.
I doubt it supports Win64 yet, lots of things don't. However, if it is
well written it is unlikely to be bitten by the one area of
non-conformance that has been identified, and including the headers from
a C implementation on Win64 is not likely to break anything.
Sorry, I misread what you said. What did you ask? What library and what
header? I know an implementation which breaks correct code, and it was
the original thing. I know a library which conforms to C90 and works
on all computers out there (even with C99 since no sane implementation
has small long) but Win64.
It is not inclusion of the standard headers that causes the problem, so
that is not a reason for avoiding including the headers. In fact, if
they used size_t as has been suggested in this thread they should then
it would not cause a problem.
I accept that it is a non-conformance of the 64 bit version of Visual
Studio (A 64 bit implementation of gcc on Win64 could well not be
broken, especially if they ever finish implementing C99).
So that *still* is not a reason to avoid including standard headers and
types, if anything it is an argument *for* using them.
I'm afraid processor bug is a little different from software bugs.
It was also a bug in the C implementation, one that was fixed under
pressure from everyone else not prepared to work around it.
Broken string functions on some platforms come to mind. Glib has
some stuff to work that around.
I've not seen mention in the documentation of working around broken
string functions, and I've not come across broken string functions. I
have come across ones that don't meet standard they don't claim to meet,
but that is another story.
Can you give a specific example of where it is working around a broken
string library, as opposed to one that does not meet a standard it does
not claim to meet, or one that is correct but does not provide the
functionality they want?
Good for you, what can I say? Not all people are so lucky, and not all
bugs are processor bugs which are so serious that addition breaks.
No, but a bug making avoidance of including standard headers would be
almost as serious since it would break stupidly large amounts of code.
Telling people they have to upgrade to the new fixed version of some
library is COMMON PRACTICE.
Again, great for you. Really great and I am glad you can workaround
problems by making them not exist in the first place. If you're saying
it's always possible and easy, you're wrong.
I've yet to come across a situation where it was not possible. Where it
was just awkward but not broken I could not argue it, but where it is
broken it is common practice to tell people they have to upgrade.
Such as what exactly? Are you saying implementation with a bug
in a standard header can't survive? I doubt it. Depends on the
bug, doesn't it? Or maybe you're saying there are no implementations
with buggy headers?
I am saying that an implementation with headers that were buggy enough
you could not safely include them would not survive. I have said this
several times. This is also why any such broken implementation would not
be a good reason to avoid using broken headers.
Um, Win64? Will it be boycotted for making small long type? Or does
it depend on the bug severity?
The standard headers are *not* so broken you cannot safely include them.
The breakage is of a different type. Also, it is not Win64 but the 64
bit version of Visual Studio.
_GNU_SOURCE thing? No clashes. Or do you mean standard C code? Who
said there are problems with that? See, library (not the C library)
developers may care about non-standard user code.
I mean exactly what I said. It is perfectly safe to include the standard
headers in conforming mode, and if you obey what the documentation tells
you (i.e. use _GNU_SOURCE correctly) it is safe to include them in
non-conforming mode.
I.e. the ONLY time it is NOT safe to include them is when YOU are at
fault. The same applies to authors of libraries. I.e., is is SAFE for
library writers to include standard headers in their headers because
things will only break when YOU do something wrong.
To put it another way, you are WRONG to say that avoiding header bugs
might be a good reason not to include standard headers ANYWHERE.
Especially open-source it seems.
I use a lot of open source, so I do know how it works. I have also been
on the wrong end of having the open source community NOT support things.
I just passed the lack of support along the line to customers and told
them we could not support it either and if they wanted to use the new
version of get bug fixes they *needed* they would have to upgrade.
Perhaps. Or perhaps not. You seem to be talking about standard
programs which use only standard headers or at least use only
standard features from standard headers.
Read the bits you have quoted earlier where I EXPLICITLY state that the
same rules apply when using the implementation in NON-conforming mode.
> You sure every implementation
has its implementation-specific extensions done in good nice
way so you can be sure #includ'ing a standard header behind
user back is safe if user uses those funny extensions?
If you use them you have to read the documentation for them as well, and
then YES, you CAN safely include them. I have been using system
specifics and extensions where appropriate since I started programming
professionally over 20 years ago (not in C back then) and it is safe.
Including on the implementations that people seem to me to complain most
about for providing extensions, gcc and MS Visual Studio.
See? Same thing. From "a header may break user code" you make conclusion
"a standard header may break standard code", though I didn't say that
and my example with _GNU_SOURCE isn't standard.
Last I looked string.h *is* a standard header. However, I EXPLICITLY
stated that it is still safe to include it in non-standard conforming
mode (i.e. using _GNU_SOURCE) as long as YOU read the documentation and
so do it correctly.
Who said I can't write my main() function? I can. Or I can ask
implementation to get me builtin translation unit with main()
which would call my FooBarMain().
The STANDARD says that the entry point for YOUR program in a hosted
implementation IS main. If the entry point of YOUR program is NOT main
then either it is NOT a hosted implementation (which is a perfectly
valid thing to be) or it is NOT compliant with the standard.
So if you invoke it so that you do not have to provide main you are NOT
invoking it as a compliant hosted implementation because the STANDARD
says that you have to provide main to a hosted implementation.
And if entry point is indeed main()? Here, let me repeat:
See everything I said above. The entry point to YOUR program has to be
main, not the entry point to something that calls your program. This is
because that is what the STANDARD says.
I have no idea how to use it properly as a Foo or C++ compiler either.
Nice nit though. Your statement is probably true, I don't really
have doubts about it.
So? You not knowing how to use it does not affect anything I said. MS
having WinMain as the entry point is legal when it is not behaving as a
hosted implementation, so they are fine there. When invoked as a hosted
implementation you have to provide main, so they are still fine.
That's right, that's why I said "user is stupid". So, a third-party
library mandates that stupid things are user's problem. It's quite
sensible, and in fact it's an approach taken by many libraries (glib
too). Now, can you guarantee there are no totally-legitimate non-stupid
things like this _GNU_SOURCE thing which could break?
Yes.
> Not necessarily
with standard C headers by the way. sys/stat.h is good too to make
developers wary of standard headers.
sys/stat.h is NOT a reason for developers to be wary of standard headers
and nothing you have said justifies your statement that it is. It would
make just as much sense to say the sinking of the Titanic was a good
reason for developers to be wary of standard headers.
Yes, even though Earth is not round. Maybe "no problems with standard
headers" is just as correct as "Earth is round"? Works fine most of
the time, but not always.
Don't you find it at all strange that you seem to be the only person who
thinks it does not work? Have you not considered that people with vastly
more experience might actually have found that compiler writers take
compliance to C89 seriously and take making their C implementations
usable as intended (i.e. including the standard headers) even more
seriously?
I think it's important not to make conclusions from absence of evidence
in technical groups. It's not a court. Exactly.
There is no evidence that you are not a figment of someone's deranged
imagination either.
Generally in both science and technical arenas the person challenging
what is generally believed has to provide some convincing evidence.
It is, if you think of C99 for a minute. stdbool.h and all that. But not
only that of course.
None of the implementations it support claim to be C99 implementations,
therefore working around them not having stdbool.h or not having an
stdbool.h that meets the C99 requirements is NOT working around a broken
implementation, it is working around an implementation being perfectly
correct and not providing what they want.
Or fixes some broken string functions for the case when they are
broken in the implementation. You sure it does not work around any
bugs in implementations?
Where? Working around a non-C99 implementation not providing C99
functionality is NOT working around a broken implementation.
Of course it's not, since gnulib is intended to be a complement to
any-C-library.
So having said it is an example of your point you now accept my
statement that it is not an example of my point.
Oh, just so you know I've decided that since you seem unable to >
understand the points others and I have made (several times above you
say you don't understand, or close enough) there is no point arguing
further with you. Believe what you will and the rest of us will be happy
knowing that we can always safely include standard headers and use
size_t, even with the small break that MS Visual Studio for Win64, since
that does not break well written code.