ly available. That is why you can use enum, it is a constant expression and it is properly scoped:
```
{
enum { N = 10 };
// N = 10
}
// N undefined
```
(#define would need a separate #undef at the end of scope )
But you are using C++ so I would recommend constexpr.
(I was joking w/ enum)
The more I program in C, the more I appreciate how powerful macros can be. You don't really need anonymous functions if you can just #define one inline before you need it, and then #undef it afterwards. It looks like you're calling a function but it just expands out to your code in the end.
#ifndef _SHH_AVAILABILITY_H
#define _SHH_AVAILABILITY_H
#include <Availability.h>
#undef API_UNAVAILABLE
#define API_UNAVAILABLE(...)
#undef API_PROHIBITED
#define API_PROHIBITED(...)
#undef __API_UNAVAILABLE
#define __API_UNAVAILABLE(...)
#endif
clang -include ShhhAvailability.h …
Sometimes I like to write an #undef for a macro that was never defined in the first place, usually in the middle of a file. Keeps the maintainers on their toes
Of course but only if you have access to that class, if you're using a library you're done. Althought I've heard people use
#define private public
#include "Stuff.h"
#undef private
But I get what you mean
#internationaldayofdemocracy, Sept 15
This illustration emphasizes that #democracy is not just about voting, but about inclusive #participation, protecting rights, ensuring justice, and maintaining institutions that serve all #people equally...
@un.org #unitednations #un #undef #vote #democracyday
#internationaldayofdemocracy, September 15
#democracy
=From Greek words, "demos", (people), "kratos" (power)
=draws its strength from people: their voices, choices, and participation in shaping their societies...
#unitednationsdemocracyfund @ungeneva.bsky.social @un.org #unitednations #un #undef
For now I'm getting around this with
#undef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
in tusb_config.h, which disables the spinlocks in tud_task() on RP2350 but lets atomics remain fully functional. Not sure what a proper upstream fix would look like which handles all multicore TinyUSB use cases
I forgot about those windows ones. I definitely have some #undef min #undef max in my project. so annoying
#ifndef USE_SCRIPT
#define USE_SCRIPT
#endif
#ifndef USE_SML_M
#define USE_SML_M
#endif
#ifdef USE_RULES
#undef USE_RULES
#endif
#ifndef USE_SCRIPT_JSON_EXPORT
#define USE_SCRIPT_JSON_EXPORT
#endif
#ifndef USE_SCRIPT_WEB_DISPLAY
#define USE_SCRIPT_WEB_DISPLAY
#endif
#include <stdio.h>
#define white Black // Program white = Black
typedef enum { Black, White } Color; // Statement: black is Black
const char* argument = "white is the Solution"; // Argument: white is the Solution
#undef Black
#define Black white // Re-Definition: Black is white
/1
#undef, undef them all!!
O Fundo para a Democracia da ONU (UNDEF) abriu inscrições (até 28/02) p/ a 19ª rodada de financiamento de projetos de fortalecimento da democracia. Serão aceitas propostas de até US$ 200 mil por org. da soc. civil para projetos de 2 anos de duração. #UNDEF #democracia #ONU
www.un.org/democracyfun...
The Fourth Hard Problem in Computer Science:
Whether to use
#define FOO 0
or
/* #undef FOO */
or
#undef FOO
or even
/* #define FOO */
for things that aren't present/enabled/turned on in a config.h. FOO can start with HAVE_ or not.
Nice. If there's text there that's supposed to represent "generics without C++", I'm not seeing it, and I *have* seen this in production code.
Also:
#define protected public
#include "thing.hxx"
#undef protected
#include <stdio.h>
#include_next <twitter.h>
#ifdef __OBJC__
#import <objc/objc.h>
#endif
#pragma once
#ifndef Auschwitz
#define Auschwitz "Nazi concentration camp"
#endif
#if 1
#warning "foo"
#elif (1 != 1)
#error "bar"
#else
#endif
#line 1
#undef Auschwitz
#ident "ab"
#sccs "c"
#undef NO_OBSOLETE_FUNCS
Ahem, IDA's ua_ana0() would like to have a word with you :) https://x.com/d_olex/status/751294499465428992