A question for the C experts - there's a difference between clang's cpp (Apple clang version 15.0.0 (clang-1500.1.0.2.5)) and gcc's cpp (riscv64-unknown-elf-cpp (GCC) 11.1.0) when preprocessing the code (without giving any command line parameters except the file name)

#define test(w) blarf(w)
test (42);
test(23);

Clang's cpp does not replace the first use of test, gcc's cpp does. What is the expected behaviour here?

#C #gcc #clang #llvm #preprocessor #unix

If you were writing a #compiler (or, in my case, a #preprocessor) and you had to think of a variable name for a "class" struct, but you can't use the keyword class... what would you call that variable?

Plot twist: The compiler/preprocessor is written in #ObjectPascal. (So it's actually a record, not a struct. Same difference.)

I'm currently using the variable name class_item which is a very un-Pascal identifier for many reasons. I'm thinking of using PClass or PsiClass just to get around it.

#Pascal #FreePascal

Cdefer: Preprocessor mới cho C/C++ với an toàn bộ nhớ hiện đại. Cấu hình tự động, dễ sử dụng. #Cdefer #C++ #AnToànBộNhớ #Preprocessor #TINTIỆNSÁCH

https://www.reddit.com/r/programming/comments/1oaqwov/c_and_c_preprocessor_for_modern_memory_safety/

How about a static website generator tool that is decades older than the web itself?

Tom Mason generates his blog with ... the C preprocessor. Genius:

https://wheybags.com/blog/macroblog.html

#static #generator #site #preprocessor #web #website #WebsiteGenerator #Jekyll #Hugo

When you've had enough of the #gcc preprocessors shtexpansion to 37000 lines, write your own good enough #preprocessor in #awk, 10 lines!! Is it all inclusive? NO, does it keep the number of lines, to, well, the number of lines and work well enough not to chew through your disk!? Absolutely!

@CyReVolt do while(0) loop is usual trick in case of macro to be able to add semicolon after macro without complaints (and yes most people want semicolon there for *various* reason (external linters etc.)

#preprocessor sux

GitHub - camel-cdr/bfcpp: Optimizing Brainfuck interpreter in the C preprocessor

Optimizing Brainfuck interpreter in the C preprocessor - camel-cdr/bfcpp

GitHub

A lot of blog engineering today, mostly doing smart #ed hacks and dealing with the consequences.

But! I came up with a way to include arbitrary files with #ed, so it's almost as powerful as #C #Preprocessor for my purposes! (Taking file name from buffer, modifying it into a reading command and then running another ed instance over this same file with this command. And using E command to read it back from modified file.)

Next: moving all the stuff I churned out to my HTML-ish format (that I should write about someday) and then to Server Side Includes (https://en.m.wikipedia.org/wiki/Server_Side_Includes) for the sake of portability?

#theWorkshop

Server Side Includes - Wikipedia

I wrote a #ML1 macro to build my #homepage, then to present the macro I wrote a #sed command, now I also include the sed script in this cursed page

https://ldbeth.sdf.org/mcs.html

#preprocessor #html

ML1 source for this website