Sujet : Re: question about linker
De : bc (at) *nospam* freeuk.com (Bart)
Groupes : comp.lang.cDate : 07. Dec 2024, 17:15:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vj1sbr$368fu$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla Thunderbird
On 07/12/2024 14:51, Tim Rentsch wrote:
Bart <bc@freeuk.com> writes:
In a 39Kloc C codebase, there were 21,500 semicolons.
>
This is generated C, so some of those may be following labels!
2000, actually, which still leaves 19,500; a lot of semicolons.
>
On a preprocessed sql.c test (to remove comments) there were
53,000 semicolons in 85,000 lines.
>
So in C, they are a very big deal, occuring on every other line.
Many years ago I read a book called "How to Lie with Statistics".
It should be updated to add this reporting as an example.
You're welcome to post your own figures.
I know your own code will be out of the ordinary as you prefer using commas (or ?:) to semicolons, and to write things horizontally rather than vertically.
Here's one of my few programs that I manually wrote in C:
c:\cx>mcc pid
Compiling pid.c to pid.exe
NLINES= 2219
NSEMIS= 1078
NSEMISATEOL= 1026
It is pretty much exactly what I said. One more (not mine):
c:\cx>mcc deltablue
Compiling deltablue.c to deltablue.exe
NLINES= 1558
NSEMIS= 707
NSEMISATEOL= 652
This one is a bit different:
c:\cx>mcc piet
Compiling piet.c to piet.exe
NLINES= 3267
NSEMIS= 753
NSEMISATEOL= 680
Semicolons occur only every 4 lines or so. Hmm, let's try preprocessing, then compile the processed source:
c:\cx>mcc -e piet
Preprocessing piet.c to piet.i
c:\cx>mcc piet.i
Compiling piet.i to piet.exe
NLINES= 1331
NSEMIS= 774
NSEMISATEOL= 719
Back to normal! I guess there were a lot of #defines, or something. It's difficult to isolate large, external headers from line counts. But that's not code that /you/ have to write; yours will be the executable code that needs the semicolons!