I don't see — |
Hi Tobias,
Assuming one can safely alter the innards of a system include with defines in one's own header files is presuming a specific implementation and likely to break at a later time. The only rational thing to do is include system headers first. In this case I had made a mistake. I should have fixed it a long time ago. — |
In reply to this post by David T Lewis
Then every file that includes a system header should start with #ifdef HAVE_CONFIG_H
#include "config.h"
#endif — |
In reply to this post by David T Lewis
Really, I do think there should be as little defines on the cmdline and the Makefiles as possible — |
In reply to this post by David T Lewis
And what, pray tell me, defines HAVE_CONFIG_H? — |
In reply to this post by David T Lewis
— |
In reply to this post by David T Lewis
How does the define get to be defined at compile time? — |
In reply to this post by David T Lewis
some makefile generators also are pretty good at also maintaining the debugflags, but that's out of scope here. So something like #ifdef HAVE_CONFIG_H
#include "config.h"
#else
#error Please run WHATEVER_OUR_CONFIG_GENERATOR IS first
#endif Which would fit nicely in either — |
In reply to this post by David T Lewis
The point is, Tobias, that the flag must de defined on the command line, that some flags must be defined in the command line. Further, the architectural pic t is that C headers are white box. They cannot provide encapsulation. Therefore when one includes a C header one is including implementation as well as API. Therefore, if one is only to see API one should not attempt to modify those headers prior to their inclusion other than by platform aprtoced Flags, such as _GNU_SOURCE, since otherwise one risks alteration in a way that will break later when the C header is modified. This is exactly the case with my having to redefine the stellar define so that it avoided breaking a specific platform’s implementation of the redirect from abstract file offsets (ftell) to concrete 64-bit offsets. The point is that architecturally a C file that is part of an application is compiled within an environment provided by a platform (different versions of macOS, Linux, Windows, etc, with different processors, etc) and that config.h serves not to alter that environment, but to provide ab abstract definition of the facilities provided by that platform. Therefore it is completely backwards to use config.h in any way to alter system includes. config.h tells one what is inside without having to look. configure does (expensive slow) black box testing on them to derive config.h. config.g is designed to inform the program of the facilities provided by the includes, not to be abused to modify those includes. Therefore, the correct way to select between different alternatives a specific platform provides (32-bit vs 64-bit, c99 vs C11 vs C18, POSIX vs GNU, etc, is external to the source code. That means on the command line, issues either from a build environment or makefiles. So given that one must and should use command line selection of alternatives can we please Adams in this idea of including our own header before everything else? C/C++/Objective-C etc are not designed to be written or compiled in this way. — |
In reply to this post by David T Lewis
If you insist, go forwad. I'd rather minimize the points that needs jiggiling to make things work. That's why I put work into making the autoconf stuff do their thing again, not because I like it. That said, this is only a commit commentary, so more of a note of potential pitfallery, not an "erhobener Zeigefinger"/no an "thou shalt do it that way" :) — |
In reply to this post by David T Lewis
On Mon, Sep 28, 2020 at 06:53:51AM -0700, Eliot Miranda wrote: > > The point is, Tobias, that the flag must de defined on the command line, that some flags must be defined in the command line. <timeout> Eliot, you are not hearing what Tobias is saying. </timeout> Dave |
In reply to this post by David T Lewis
David, with respect, I am currently trying to deploy an extremely complex Squeak application that includes C++, Objective-C, and mixed C++/Objective-C plugin code, threads, etc, on both MacOS and Windows. I am not trying to defeat autoconf or anything. I am trying to get the VM to compile. Trying to clean up inconsistencies, and breakages, so that our company can deploy a product and does not fail. I don't have time to suffer major disturbances in the VM code right now. Please Tobias, if you want to include config.h in front of ever file go ahead, but do it on a branch. I will note that only some projects take this approach, and many complex ones include config.h after system headers. And that this approach makes sense. A given platform's headers provide an API, alas as a white box A config.h file from autoconf is a synopsis of a given variation of the system headers, defining to the program what facilities are available, without the rest of the program having to manually determine (often impossible at run-time, often hard to do so at compile-time). It is a communication to the program, not a communication to the headers. This isn't me being obstructive or trying to sabotage config.h or autoconf. It is the architectural reality of C/C++/Objective-C, is it not? — |
In reply to this post by David T Lewis
let's stop here. it was just me trying to be cautious. Eliot is investing time they obviously is better spend him doing his work than arguing with me/us. :) the case at hand is actually not that important -- Sent from a mobile device — |
Free forum by Nabble | Edit this page |