bug-gperf
[Top][All Lists]
Advanced

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

[bug-gperf] modernizing


From: Albert Cahalan
Subject: [bug-gperf] modernizing
Date: Sun, 8 Nov 2009 21:00:45 -0500

It's 2009, nearly 2010, yet gperf still defaults to pre-historic C.
There isn't even any reason to support that anymore. Even proprietary
systems from Sun and HP have ANSI compilers now.

The register keyword is way-obsolete ugly cruft. It's not even
being used in a reasonable way; there aren't enough local variables
for it to make sense even if modern compilers cared.

There should be a way to put arbitrary compiler-specific attributes
onto the functions. For example, __attribute__((visibility("hidden")))
__declspec(fastcall), static, or __forceinline could be added.

I particularly want to make in_word_set static.

There should be a way to set a global prefix, much like the "yy" used
for lex and yacc. Case should be adjusted to match context, so that it
is all uppercase for #defines and all lowercase for functions. Specific
names take priority of course, and don't get the prefix.

There should be a way to get linux-kernel style indentation.
(at minimum: real tabs, opening curly braces not by themselves,
and the closing curly brace not indented at all)

The requirement that "name" to be first in the struct is trouble.
For example, it can cause padding when vectors are in use. A nice
solution is C99 struct initializers. This is more maintainable too,
since the programmer is then free to reorder struct members without
any concern for upsetting brittle ordering constraints.

There should be a way to get the restrict keyword on all pointer
arguments. You could make it an option, or do something like this:

#if __STDC_VERSION__ >= 199901
#define gprof_restrict restrict
#elif _MSC_VER >= 1400
#define gprof_restrict __restrict
#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 92
#define gprof_restrict __restrict__
#else
#define gprof_restrict
#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]