sys/arch/hpcmips/tx: tx39ir.c
andvar: remove unneeded #undef TX39IRDEBUG.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/hpcmips/tx/tx39ir.c.diff?r1=1.10&r2=1.11
sys/arch/hpcmips/dev: plumvideo.c
andvar: Remove "#undef PLUMVIDEODEBUG", it is not defined by default.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/hpcmips/dev/plumvideo.c.diff?r1=1.44&r2=1.45
Google: “The problems introduced by macros are especially severe when they are used to define pieces of a C++ API… As a consequence, we specifically disallow using macros in this way.”
Also Google:
// clang-format off switch (fd.value.type.base_type) { #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \ case BASE_TYPE_ ## ENUM: \ if (!GenField<CTYPE>(fd, table, struct_def.fixed, elem_indent)) { \ return false; \ } \ break; FLATBUFFERS_GEN_TYPES_SCALAR(FLATBUFFERS_TD) #undef FLATBUFFERS_TD
Google: “The problems introduced by macros are especially severe when they are used to define pieces of a C++ API… As a consequence, we specifically disallow using macros in this way.”
Also Google:
// clang-format off switch (fd.value.type.base_type) { #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \ case BASE_TYPE_ ## ENUM: \ if (!GenField<CTYPE>(fd, table, struct_def.fixed, elem_indent)) { \ return false; \ } \ break; FLATBUFFERS_GEN_TYPES_SCALAR(FLATBUFFERS_TD) #undef FLATBUFFERS_TD
@vk3tcp
Wow, the K3NG code has many features beside the keyer itself.
(Now, I remember to have seen it times ago).
Seems that most "extra" functionalities can be #undef
I only want to drive my collection of Oldies like the Heathkit SB-300 and SB-102 or my 2 Yaesu FT-101ZD (still on the bench).
For those interested, I found some directions for a minimalist K3NG keyer configuration here:
https://www.egloff.eu/index.php?Itemid=635&lang=en
@amdg2 aha, right, good point about conditional includes! And the same defer mechanism would be just as useful for undefining macros. So, I imagine something like this:
// in stdlib.h
#define __cplusplus
#include <algorithm>
#defer
#undef __cplusplus
#uninclude <algorithm>
#enddefer
static inline void qsort(whatever) {
// Efficient implementation using std::sort
}
#define #include #defer #undef #uninclude #enddefer
abolish the institution of private ownership of real estate.
"ownership" is not a naturally occurring phenomenon.
It's a bad LARP rule. It could just be #undef'd, and we'd all be better off.
https://www.curbed.com
/2023/01/nyc-real-estate-covid-more-apartments-higher-rent.html
misc/celestia: distinfo options.mk
misc/celestia/patches: patch-src_celengine_body.h
...
dholland: misc/celestia: #undef "sun" for use as an identifier, because solaris.
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/misc/celestia/distinfo.diff?r1=1.29&r2=1.30
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/misc/celestia/options.mk.diff?r1=1.10&r2=1.11
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/misc/celestia/patches/patch-src_celengine_body.h?rev=1.1
So an interface uses macros as arguments then #undef's them, then the implementation uses those macros and uh... OK so that means the interface must separate into start, and undef, so the implemenation can put code in between.
Then something uses that snippet, and itself has to include start and undef headers, so its implementation can use those definitions.
Then something uses that snippet twice, to define two different data types, and uhh... nothing works it can't be fixed it's broken forever.
Angband does a pretty interesting thing to define game elements
It has files called list-[name].h
that just contain something like this (this is from list-terrain-flags.h
):
TF(NONE, "")
TF(LOS, "Allows line of sight")
TF(PROJECT, "Allows projections to pass through")
TF(PASSABLE, "Can be passed through by all creatures")
TF(INTERESTING,"Is noticed on looking around")
TF(PERMANENT, "Is permanent")
TF(EASY, "Is easily passed through")
TF(TRAP, "Can hold a trap")
TF(NO_SCENT, "Cannot store scent")
// ... more of this, you get the idea
and any place that needs to do something over the entire list does
#define TF(a, b) // whatever the result should be
#include "list-terrain-flags.h"
#undef TF
Pretty cool method to centralize the declarative data and make it possible to do things with it in multiple places.
Probably wouldn't do that way with Rust tho.
@m455 Alongside your existing compiler flags for optimization and such, you can use something like -Wall -Wextra -std=c89 -pedantic
in Clang or GCC to get strict ANSI enforcement. Make sure to #undef
some feature test macros (https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html) like _POSIX_C_SOURCE
if you want truly portable code without extensions.
@bcallah from gcc 10.2 stddef.h (beware: gpl3)
if defined (_STDDEF_H) || defined (__need_NULL)
#undef NULL /* in case <stdio.h> has defined it. */
#ifdef __GNUG__
#define NULL __null
#else /* G++ */
#ifndef __cplusplus
#define NULL ((void *)0)
#else /* C++ */
#define NULL 0
#endif /* C++ */
#endif /* G++ */
#endif /* NULL not defined and <stddef.h> or need NULL. */
#undef __need_NULL
#undef #ifdef #define #else #ifndef #endif
Source code for the core formula definition:
```
#donotrun
/*
Experimental Magnet-Mandelbrot bulb triplex fractal.
Type 1: z_{n+1} = [(z_n^2 + c-1) / (2z_n + c-2)]^2
*/
#define MAGNETBULB(TRIPLEX, VEC, real) \
void Magnetbulb1Triplex(inout VEC w, in VEC c) \
{ \
TRIPLEX one = TRIPLEX(real(1), real(0), real(0)); \
TRIPLEX two = TRIPLEX(real(2), real(0), real(0)); \
TRIPLEX d = TRIPLEX(c.v[0], c.v[1], c.v[2]); \
TRIPLEX z = TRIPLEX(w.v[0], w.v[1], w.v[2]); \
z = sqr(div(add(sqr(z), sub(d, one)), add(add(z, z), sub(d, two)))); \
w.v[0] = z.x; \
w.v[1] = z.y; \
w.v[2] = z.z; \
w = add(w, c); \
}
MAGNETBULB(Triplexfx, Vec3fx, floatx)
MAGNETBULB(TriplexDual3f, Vec3Dual3f, dual3f)
#undef MAGNETBULB
```
The rest of the framework is Too Big To Toot.