Liste des Groupes | Revenir à cl c |
On 22/03/2025 03:50, Keith Thompson wrote:[...]bart <bc@freeuk.com> writes:On 21/03/2025 19:04, Keith Thompson wrote:bart <bc@freeuk.com> writes:
>First you talked about compilers grinding to a halt, then you talked>I think your response clarifies matters. Nobody cares, even asIf compilers ground to a halt, I would certainly care. They don't.
compilers grind to a halt under all preprocessing.
50 modules each including GTK.h say, which was 0.33Mloc across 500
headers (so reading 16Mloc and 25,000 headers in total when all are
compiled) would not impact your builds at all? OK.
about headers not impacting builds at all. Those goalposts of yours
move *fast*.
You missed the "?".
For the record, as you can see above, I did not say that builds would>
not be impacted. Do not put words into my mouth again.
Let me ask it again: so ploughing through a third of a million lines
of code across hundreds of #includes, even at the faster throughput
compared with compiling code, for a module of a few hundred lines,
will have little impact?
>
How about a project with 50 or 100 modules, each using that big
header, that needs to be built from scratch?
So let me ask /this/ again: if such a library consisted of ONE compact
header file, would it make the process simpler? Would it make
compilation of multiple modules faster?)
>printf("%v\n", t); # (used to be '?'; changed to 'v')That's nice. Seriously, it's nice. If it were added to a future
}
>
The compiler replaces the 'v' format with a conventional format code
according to the type of the expression. For my 'time_t', it happens
to be 'lld'.
edition of the language, I'd likely use it (once I could count on it
being supported, which would take a while).
The Go language has something like that.
You can add extensions like that to your own compiler easily
enough. Adding them to the C standard (which requires getting all
implementers to support them) is a lot harder. Does it work for
both output (printf) and input (scanf)? What if the format string
isn't a string literal; does the compiler generate code to adjust
it, allocating space for the translated string and deallocating it
after the call? Does it work with printf("%n", &var)? What about
qualifiers, specifying width, base, and so forth.
My feature was a proof of concept. The 60 lines of code used to test
it worked specifically for 'printf', and didn't attempt to parse
additional attributes like field widths (I wasn't implementing half of
printf).
It only works when the format string is a literal (but so does gcc's
checking that format codes match parameter types).
C probably introduced variadic functions just for this purpose (which
remains challenging to implement!).
(I deal with it in my languages by having Print as a statement, with
special syntax. But internally the result is a series of function
calls (print_i64 etc); ugly, sprawling code. Users will not see it,
but I do.)
Les messages affichés proviennent d'usenet.