The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [macros]

A macro in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to a replacement output sequence (also often a sequence of characters) according to a defined procedure. Do not use this tag for questions regarding Microsoft's Visual Basic for Applications.[Tag:vba] evolved from an early macro language, but is not a macro language.

12 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
14
votes
0answers
181 views

Signed integer-to-ascii x86_64 assembler macro

I have implemented an algorithm which converts a signed integer to its ASCII equivalent string with the corresponding sign as a first byte. I have tested it on several numbers and it worked correctly. ...
13
votes
0answers
508 views

Autotools detect C++ language standard support

I have been updating my build tools to optionally use autotools (autoconfig/automake/libtool etc.). As part of this change I have written a couple of M4 macros. This not being something I have done ...
3
votes
0answers
61 views

Racket macro for variadic FFI

I'm working on FFI wrapper for SDL2 library in Racket. The library includes several variadic functions (e.g. SDL_SetError, SDL_LogMessage etc); Racket FFI does not have straight way for importing ...
3
votes
0answers
84 views

Allowing switching between operator[] and at() based on NDEBUG macro version

The problem: std::vector and other containers have two functions for accessing / modifying their content: operator[] and ...
2
votes
0answers
61 views

Simple generic macro-generated containers

In order to learn macros in C I decided to make a generic data structures generator for other projects that I have in C. The main macros are the following: ...
2
votes
0answers
287 views

Interpreter for an assembly language with variadic instructions

I am currently implementing a virtual machine that runs a programming language similar to assembly. The difference is that an instruction in this language can have any number of operands. and the ...
2
votes
0answers
93 views

`multiple-value-call` in Scheme

Common Lisp has a "special operator" called multiple-value-call, which does something similar to Scheme's call-with-values but ...
1
vote
0answers
29 views

Solution: clang preprocessor concatenates an extra space vs. gcc - standard C99

I maintain a C library project both on gcc and clang. I am looking for advice on how to make the following macros more portable, terse, readable or standard abiding. When I compile ...
1
vote
0answers
54 views

Clojure macro to gather functions in a namespace into a map

I'm learning Clojure via a pet project. The project would consist of several workers that would be called from other functions. Each worker is defined in their own namespace as a set of functions (...
1
vote
0answers
52 views

Implementation of catch test framework in Racket

As an exercise in learning how to use Racket macros I decided to implement a subset of the features in the catch test framework for C++. In particular the catch test framework has a unique feature ...
1
vote
0answers
60 views

Creating class method using macro to accept Visitator for each of their fields

I had a lot of classes that used a macro with listed fields. The macro was used to serialization, more like MSGPACK_DEFINE. I need a substitution of this mechanism, ...
0
votes
0answers
47 views

Rust procedural macro (proc_macro) to generate static and dynamic bindings to system functions

This is my first attempt at a Rust procedural macro, so there might be a few spots where it can be improved. Reviews and recommendations welcome. The proc_macro: ...