Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [c-preprocessor]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer

C - Force a macro argument to be a string literal

The requirement is to define a macro which takes a single argument that is a string literal. My first try at it was to surround it with empty string literals (I got this from Modern C): ...
Harith's user avatar
  • 6,696
7 votes
2 answers

Consolidating GNU C's and C23's attributes

C23 has introduced attribute specifier sequences. Consequently, the header below attempts to conditionally define macros for these sequences (for my own use cases). In cases where a compiler does not ...
Harith's user avatar
  • 6,696
2 votes
0 answers

Implementing Generic, General, Specific and Portable Bitwise Operations

First my appologies. My mental faculties currently leave rather a lot to be desired and I have thus spend an inordinary amount of time on this pet project of mine, testing myself if you will. I find ...
Zacariaz's user avatar
  • 373
5 votes
1 answer

Instance specific code generation

Disclaimer: I've asked this question before on Stack overflow and got a response that this place would be a better fit so I am copy pasting the question here. I've come up with two different ...
user1806687's user avatar
12 votes
4 answers

C generic dynamic array (using preprocessor)

I wrote a generic dynamic array using the preprocessor. My use case for it is a compiler I'm writing that uses dynamic arrays a lot, and my current void pointer implementation is becoming a bit hard ...
Itai Nelken's user avatar
5 votes
1 answer

C smart string implementation using preprocessor

I have wrote a smart string container implementation for use in my application, but as I'am not such professional C programmer I have doubts about is I'am did it right and is there ways how to improve ...
Alex's user avatar
  • 53
3 votes
0 answers

Implement easy CLI options in C using a single-file header

I'm a computer science student, and in 2 of my courses this semester we are writing short C programs to demonstrate the things we are learning about. All of these programs require command-line flags &...
Jake Grossman's user avatar
1 vote
1 answer

c++ is it worth preprocessor optimization for for loops while i < 1 [closed]

I'm writing some code to take high precision timings of a function call ...
Jay's user avatar
  • 214
4 votes
1 answer

Macro for counting number of elements in an array

We all know the classic version of counting the number of elements in a C array: sizeof(a)/sizeof(*a) But this is dangerous, because if used on a pointer it will ...
klutt's user avatar
  • 903