preprocessor


Save string in C preprocessor


We have following macros:
#define START(x) [...]
#define FOO(x, a, b, c) [...]
#define BAR(x, a, b, c) [...]
#define END(x) [...]
We have piece of code:
START(foobar)
FOO (foobar, 1, 2, 3)
FOO (foobar, 0.1, 0.2, 0.3)
BAR (foobar, 2, 3, 4)
END (foobar)
Can we do something to let START store foobar somewhere? To xform previous into:
START(foobar)
FOO (1, 2, 3)
FOO (0.1, 0.2, 0.3)
BAR (2, 3, 4)
END ()
(something like #define FOO(x) #define VAR x)
What about:
definition:
#define START() [...VAR...]
#define FOO(a, b, c) [...VAR...]
#define BAR(a, b, c) [...VAR...]
#define END() [...VAR...]
usage:
#define VAR foobar
START()
FOO (1, 2, 3)
FOO (0.1, 0.2, 0.3)
BAR (2, 3, 4)
END ()
#undef VAR

Related Links

Adjust data vector to have certain variance
Pre-process Laravel 4 view
File iteration with the preprocessor
processing strings of text for neural network input
How to Set Active Target in XCode 4.5+
Preprocessor assertions in arduino
expanding a macro within a macro definition
GNU-M4: Strip empty lines
Escaping space in OpenCL compiler arguments
Does Corona have preprocessor statements so I can execute Lua code for specific devices?
Preprocessing in C++
Truncate string in cpp (preprocessor)
C++ precompiler conditionally include code
DDK preprocessor directives
Preprocessor, Postprocessor, Geometric Processor and NC processor
Gfortran pre-processor directives for Different Operating systems

Categories

HOME
django
fabricjs
jpa
developer-tools
pagination
pda
pyqt
swt
bitbucket-api
xbee
square
tvos
iis-6
data-visualization
syntaxnet
redis-sentinel
nancy
comsol
docx
altera
microsoft-dynamics-nav
smartclient
boost-icl
asp.net-core-webapi
visual-glitch
game-theory
jquery-multiselect
licensing
fragment-backstack
mat
handler
android-things
exchangewebservices
volatile
hibernate-validator
linkedhashmap
dsx-desktop
lubridate
playframework-2.1
odroid
xv6
file-sharing
linter
dbcontext
headless
type-theory
gets
ziparchive
parfor
delta
vorpal.js
kango-framework
deep
nss
fink
invoke-sqlcmd
mobiledoc-kit
grgit
computer-architecture
jdi
rate-limiting
pax-exam
cgi-bin
.bash-profile
keyup
omnifaces
node-serialport
addressing-mode
post-commit-hook
metatrader5
psr-4
lambda-architecture
koala
multiautocompletetextview
ice-cube
cardreader
robotlegs
qglwidget
zend-rest
glui
flvplayback

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App