10 Topics

Member Avatar for
Member Avatar for saurabh.mehta.33234

Why does the following line of code generate error as " pasting / and / doesnot generate a valid preprocessing token"? Can someone please help #define comment /##/ int main() { comment printf("hello"); return 0; }

Member Avatar for deceptikon
0
161
Member Avatar for hackit

I want to learn how to use preprocessor #pragma in C? can anyone please help me to understand..

Member Avatar for Ancient Dragon
0
95
Member Avatar for Labdabeta

I was wondering if there is any way using the mingw g++ compiler to make code that acts like this: [CODE]#define myLanguageBlock(X) doMyLanguageBlock(#X) void doMyLanguageBlock(const char* code){/*this executes the code as if it were in another language, I have already written this function*/} int main() { myLanguageBlock( this is all …

Member Avatar for Labdabeta
0
265
Member Avatar for Labdabeta

here is the question, what does str(X) become [CODE]#define str_(X) #X #define str(X) str_(X)[/CODE] when X is a string? is it ""string"" or "\"string\""?

Member Avatar for Labdabeta
0
109
Member Avatar for acechauhan

Hi, I am just starting to code in C. While using the [code=c]#define sec 3600[/code] the compiler returned an error - expected identifier or ‘(’ before numeric constant. [code=c]#define sec 3600 #include<stdio.h> #include <stdlib.h> int main(){ /*Rest of the code*/[/code] If I change sec to seconds, the compiler does not …

Member Avatar for asitmahato
0
162
Member Avatar for Labdabeta

I know that this [ICODE]#define QUOTE(X) #X[/ICODE] turns X into a c-string version of whatever is passed to it. my question is if there is a way to do this in reverse ie: [ICODE]#define DEQUOTEANDCALLFUNCTIONORCLASSWITHGIVENNAME(X) (X#)()[/ICODE] is this possible?

Member Avatar for mike_2000_17
1
152
Member Avatar for deliezer

Hi I am trying to write something that compiles and runs correctly on both Linux and Windows. I am running bash in Ubuntu on Linux, and I try to set environment variables in the makefile just before the compile lines. I then write something in the code like [CODE] int …

Member Avatar for deliezer
0
2K
Member Avatar for jackmaverick1

Hi! I've been making a rather large (but not huge, by any means) program and it needs, or so I think, a couple of classes and I want them to use inheritance to make my life easier. However, when I try to include all of my files in the main …

Member Avatar for jackmaverick1
0
216
Member Avatar for mwjones

I'm running into a snag using the [B]_emit[/B] pseudoinstruction, but more accurately a snag using the C preprocessor. I have an array of op codes from which I want to randomly select one and _emit it into the program's code. Here is an example: [CODE]unsigned char opcodes[] = { 0x60, …

Member Avatar for mwjones
0
170
Member Avatar for Labdabeta

I am working on making an error header file and this is what I have: [CODE]#include <stdio.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <string> #define VANARGS(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n33,n34,n35,n36,n37,n38,n39,n40,n41,n42,n43,n44,n45,n46,n47,n48,n49,n50,n51,n52,n53,n54,n55,n56,n57,n58,n59,n60,n61,n62,n63,N,...) N #define __VA_NARGS__(...) (VANARGS(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)) #define ERROR(...) (\ (__VA_NARGS__(__VA_ARGS__)==0)?"NONE":(\ (__VA_NARGS__(__VA_ARGS__)==1)?(_1(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==2)?(_2(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==3)?(_3(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==4)?(_4(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==5)?(_5(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==6)?(_6(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==7)?(_7(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==8)?(_8(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==9)?(_9(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==10)?(_10(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==11)?(_11(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==12)?(_12(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==13)?(_13(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==14)?(_14(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==15)?(_15(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ …

Member Avatar for Labdabeta
0
252

The End.