[net.lang.c] unlimited length identifiers, and question about arrays of void fun

"Leigh L. Klotz" <KLOTZ@BBNG.ARPA> (01/08/85)

Instead of hacking the compiler to hash names, how about writing
a program in C which grovels over the source files and produces an
include file containing definitions like

#define find_largest_mersenne_prime_unless_its_tuesday G00001

which are included in every file in the make via the -I flag.
Presumably someone has already implemented the suggestion
somewhere.  I realize it doesn't work in the general case for making
libraries and such, but it sounds useful enough to me in my work that
I'm planning to write such a program.  Not wanting to delve into parsing
C files, I'd prefer to have one written by someone else.

Also, there was some discussion recently about arrays of pointers
to functions returning void not working in PCC.  We've recently been
bitten by this and I was wondering what the upshot of the discussion was.
If there's a solution other than just not using void declarations on
the functions, I'd like to hear about it.

Thanks,
Leigh.

Doug Gwyn (VLD/VMB) <gwyn@Brl-Vld.ARPA> (01/08/85)

Pointers to functions returning voids are broken in older PCCs,
including the one distributed with 4.2BSD.  They work fine on
more recent incarnations of PCC though.

geoff@desint.UUCP (Geoff Kuenning) (01/11/85)

In article <7079@brl-tgr.ARPA> "Leigh L. Klotz" <KLOTZ@BBNG.ARPA> writes:

>Instead of hacking the compiler to hash names, how about writing
>a program in C which grovels over the source files and produces an
>include file containing definitions like
>
>#define find_largest_mersenne_prime_unless_its_tuesday G00001
>
>which are included in every file in the make via the -I flag.

Um, you just ran yourself into the old PCC fixed-size-string-table problem.
If you try that trick on large programs, especially ones that already have
lots of #defines, the preprocessor will bomb on a string space overflow.
Pretty useful for small ones, though.

>Also, there was some discussion recently about arrays of pointers
>to functions returning void not working in PCC.  We've recently been
>bitten by this and I was wondering what the upshot of the discussion was.
>If there's a solution other than just not using void declarations on
>the functions, I'd like to hear about it.

I have been using -Dvoid=int except when I lint things.  Someday, when I get
a compiler that handles voids correctly, I'll take that out.
-- 

	Geoff Kuenning
	...!ihnp4!trwrb!desint!geoff