On Wed, Nov 01, 2006 at 10:05:44PM +0100, Fabian Groffen wrote:
Hi,
Please find attached a (compressed) patch which loop lifts all loops in the pathfinder sources such that variable declarations go at the top of the scope the loop is in, or a higher scope if more appropriate.
Rationale: I don't feel like appending stdc99 flags in a (possible) Gentoo ebuild for the next release.
In other words, this patch removes the C99 requirement, which I think more people will benefit from, such that MonetDB/* cleanly compiles with --disable-strict.
Hi all, though I acknowledge the amount of work Fabian has put into this, I don't really see the sense behind this patch. The Pathfinder code heavily depends on many many C99'isms, and we all agree that the use of C99 features makes the code much more readable and---most importantly---less prone to errors. The patch that Fabian distributed here only removes a tiny part of the C99 dependency, namely variable declarations within `for (...)' clauses. I think this specific part of C99 dependence has never been a concern in our project. These are rather straightforward to remove (as Fabian did), but also never really made any trouble during compilation. What makes our code really C99 dependent are mainly variable initializers in our code. We have plenty of situations where we do type varname[] = { [pos1] = value1, [pos2] = value2, ... }; or struct foo = (foo) { .bar = v1, .baz = v2 }; etc. *These* are the situations where we need the C99 dependency. And these are also the situations where we *don't* want to rewrite our code to ANSI C. The availability of these language features are quite crucial to the style we program in Pathfinder. Removing them would make our code *very* fragile, as we would suddenly depend on the *order* in which, e.g., bindings occur in an array. I don't have any real problems with the patch Fabian provided. It is a matter of taste where one prefers to declare variables. The path does *not*, however, remove our dependency on C99 features. @Fabian: What is the reason that you don't want to have the -std=c99 flag in your next ebuild? The compilers available for Linux provide excellent C99 support. Only the ignorance of Microsoft in their compiler suite makes the use of C99 appear a bad thing. Regards, Jens P.S.: I'm not yet through with a successful native compile of Pathfinder on Windows using the Intel compiler. It seems like also the Intel compiler has some problems with variable initializers, but only if they get a bit more complex (we had this on the Linux side some time ago, icc v7 or so). This seems to only affect two or three situations in our code, and we were already discussing solutions to this here in Garching. -- Jens Teubner Technische Universitaet Muenchen, Department of Informatics D-85748 Garching, Germany Tel: +49 89 289-17259 Fax: +49 89 289-17263 I invented <Ctrl><Alt><Delete>, but Bill Gates made it famous. -- David Bradley, member of the original IBM PC design team