luajit-ffi

David Nadlinger see at klickverbot.at
Wed May 2 09:23:25 PDT 2012


On Wednesday, 2 May 2012 at 12:36:03 UTC, so wrote:
> Why don't you give a link to the source where they use 
> preprocessor heavily?

Like many other C libraries, OpenSSL implements quite a few 
functions in terms of macros for performance reasons, so that 
they can be inlined (like [1]). Additionally, the OpenSSL guys 
also rely on macros to generate things like their ASN1 interface 
([2], [3]), collections (»safe stacks«), …

> And "even" if they do, did i say "all" libraries? Yes you 
> managed to come up with a library which includes tons of header 
> files in the sea of mature C libraries.

Well, after more or less telling Alex that he has no clue what 
he's talking about, you implied that most of the »mature« 
libraries would make only moderate use of the preprocessor for 
constants. In this generality (»Have you ever used a C api, say 
OpenGL? What are they using preprocessor for? other than enum and 
alias?«), this is simply not true. As Alex pointed out, it's 
often even the other way round: The older and more mature a 
library is, the more preprocessor macros it uses to deal with 
various subtle incompatibilities between all the different 
systems out there…

David


(These links are to
[1] 
https://github.com/D-Programming-Deimos/openssl/blob/master/C/bn.h#L369
[2] 
https://github.com/D-Programming-Deimos/openssl/blob/master/C/asn1.h#L301
[3] 
https://github.com/D-Programming-Deimos/openssl/blob/master/C/asn1t.h#L85


More information about the Digitalmars-d mailing list