a program that processes input data to produce output that is used as input to another program.
0
votes
1answer
23 views
CSS Document Generator that works with preprocessors
I am currently looking at CSS Preprocessors in particular LESS and Sass (currently leaning towards Sass). However, I'm also looking at CSS Document Generators too (like KSS, CSS_Doc, StyleDocco etc.). ...
0
votes
1answer
19 views
Compass grid mixin generating over 16,000 characters of CSS
Today I installed Compass and thought I'd try to generate a grid background to help me line things up.
I checked the docs ...
3
votes
2answers
59 views
C Compiler Optimization - Macros Involving Arithmetic
I am debating an optimization issue with a friend, and need some assistance tracking down both the answer to this problem, and hopefully some official documentation I could read further.
I am told ...
-1
votes
1answer
10 views
Using sass --watch with directories
In the Sass manual, it says sass --watch takes 2 arguments: either input_file and output_file, or input_directory and output_directory.
You'll notice when watching files only, we get to explicitly ...
0
votes
3answers
65 views
Avoid code duplication in read/write functions using preprocessor
If I have a pair of long functions:
#include <stdio.h>
#include <stdlib.h>
void writeData()
{
FILE *fp; int someVar1 = 1; int someVar2 = 2; int someVar3 = 3;
fp = ...
0
votes
1answer
27 views
Compile a single CS project in a solution twice, one with a preprocessor constant defined and one without it
The idea is mainly to make my service read-only (due to security reasons) by checking whether a preprocessor constant is defined or not. I will have
#if READONLY
throw new ...
0
votes
1answer
34 views
Change #define argument
I'd wrote a preprocessor define statement for a getter method
#define GetNSStringDefaultForPropertyWithNameAndKey(propertyName, propertyKey) - (NSString *)propertyName { return [[NSUserDefaults ...
0
votes
1answer
46 views
Convert C/C++ #if and #elif directive to C#
I'm trying to convert C/C++ code to C# programatically. I have encountered a problem when converting preprocessor directives, especially with #if and #elif since the preprocessor for C/C++ accepts ...
0
votes
0answers
12 views
Keep comments in preprocessor i file
We want to use the preprocessor output file (.i file ) for further use, especially the comments.
For that, we use the /PREPRINT (or /PP) command line switch.
The problem is that the KEIL compiler ...
1
vote
2answers
45 views
Is there a way to use a preprocessor macro inside of another function-like macro?
I found a neat Clang-specific feature that lets you know if a header exists before actually including it (__has_include). I was trying to come up with my own macro to do something like the following:
...
1
vote
1answer
51 views
Can I use Visual Studio debugger within #define functions?
I am using Visual Studio 2010 (writing C++) and have isolated an exception coming from a call to a #define function. The defined function is a bit complex and I would like to be able to step through ...
0
votes
2answers
36 views
Using typeof to convert a variable declaration to a type?
Currently, I have a scenario much like this:
#define my_macro(var) __builtin_types_compatible_p(typeof(var), foo) ? do_something : do_something_else
However, inadvertently the macro gets passed ...
0
votes
1answer
27 views
how to fix this stringise error
#define GETSTRING(s) return #s
enum a_type { SMALL, MEDIUM, LARGE };
const char* get_data(a_type a) { return GETSTRING(a); }
int main() {
a_type at = SMALL;
const char* s = get_data(at);
...
2
votes
2answers
31 views
Strange syntax error C2143 in Visual only (missing ';' before 'type')
I'm getting a strange compilation error for a C code in MSVC only. More precisely :
error C2143: syntax error : missing ';' before 'type'
C2143 is a fairly generic error, and there are myriad of ...
8
votes
3answers
122 views
Why can't we use the preprocessor to create custom-delimeted strings?
I was playing around a bit with the C preprocessor, when something which seemed so simple failed:
#define STR_START "
#define STR_END "
int puts(const char *);
int main() {
puts(STR_START hello ...
1
vote
1answer
44 views
Variadic macro with no arguments for its variadic parameter
Is it legal to invoke a variadic macro M with no arguments for its variadic parameter?
The relevant standard quote is [cpp.replace]/4:
If the identifier-list in the macro definition does not end ...
4
votes
3answers
130 views
Check if number is prime during compilation in C++
I have a template class that takes an unsigned integer as template parameter, but I have to make sure that number is a prime. I can check it in the constructor, for instance, but it would be better to ...
1
vote
2answers
63 views
How to detect Apportable with preprocessor flags?
This is related to my other question
When I build my project with Apportable, it assumes Linux/Android platform. I think these preprocessor flags are set.
__linux
ANDROID
But, my source code ...
1
vote
2answers
11 views
preprocessor directive with hash
#define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}
This code gives output 100, but if the preprocessor is implemented, printf will be rewritten as,
printf("%d",var##12);
Then, ...
-2
votes
3answers
86 views
string #define returns randomly integer
As far as I know #define is just a string replacement and it's not a variable, so it doesn't have any memory address or something.
Suppose this code:
#include <stdio.h>
#define ONE "a"
...
0
votes
1answer
61 views
In C, is there a better way to calculate uncertainty values?
What I've been doing is using a #define UNC (uncertainty) to toggle on and off the functionality for calculating x (the value) and dx (the uncertainty). It works pretty well, but it's not easy to read ...
7
votes
5answers
251 views
what's this C++ macro meaning?
I can't figure out what this macro means:
#define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
DECLARE_HANDLE(HWND);
I have learned from The C Program that
"##" meaning connect the ...
0
votes
0answers
8 views
Getting define values
Is it possible to get the actual values of defines used by preprocessor during the project build aswell as macro final definitions?
This is the question connected with big projects for instance ...
1
vote
2answers
74 views
Preprocessor invalid preprocessor token error
I am reading a book to learn C. In that book is the following example code giving a preprocessor error with gcc (Debian 4.7.2-4) 4.7.2. The error is
file.c: In function ‘main’:
file.c:16:14: error: ...
-2
votes
1answer
29 views
Check for a Variable in Sass mixin & print it if it's defined
I'm creating a Sass mixin with 3 arguments one of them is optional & I want to print it out if it's passed otherwise I don't want to print anything.
Here is how my mixin looks like:
@mixin ...
1
vote
1answer
42 views
Cross Compiling Samba 4.0.5 i686 to MIPS
I've been assigned to cross compile samba 4.0.5 from i686 to MIPS in order to port it on board later. I'm compiling in ubuntu 13.04 .
The error I get is:
lib/sysquotas_4A.c: In function ...
2
votes
1answer
60 views
Global variable vs macro expansion for string literal
I'm trying to understand some of the intricacies the preprocessor and of the C compiler (specifically, the gnu gcc) and string literals. Is it more efficient to just assign a global variable for a ...
1
vote
1answer
25 views
Solaris and Preprocessor Macros
Would someone post the results of cpp -dM < /dev/null from a Solaris 10 or above system?
I'm having trouble locating what preprocessor macros are typically defined. Solaris documentation does not ...
0
votes
1answer
37 views
Preprocessing via express middleware or through build system
Is preprocessing static resources through middleware (using express) a good idea for production environments? From my understanding the middleware stack is run, in series, for every request. Wouldn't ...
0
votes
1answer
60 views
Concatenate & minify directory of JS files into one JS file with Guard and UglifyJS
I have a folder of JS plugins that i would like to concatenate and minify into a plugins.js file using Guard and UglifyJS
Here's what I have in my Guardfile so far
guard 'uglify', :input => ...
6
votes
3answers
61 views
Combining two #defined symbols in C++ preprocessor
I want to do:
#define VERSION XY123
#define PRODUCT MyApplication_VERSION
so that PRODUCT is actually MyApplication_XY123. I have tried playing with the merge operator ## but with limited ...
2
votes
1answer
44 views
Are #include directives processed prior to macro expansion regardless of their location within a file?
I came across some code the other day that was similar to the following (the following has been over-simplified for the sake of brevity):
config.h
#ifndef __CONFIG__
#define __CONFIG__
#define ...
0
votes
2answers
48 views
Generate a string based upon a class template's typename?
What I'd like to be able to do...
I have a templated class which sets up a (named) shared memory pool based upon the type of object passed as the type parameter. I was wondering if, possibly through ...
2
votes
2answers
72 views
How to use the #error directive - C++
I'm creating a self initializing arrays class in C++ and i'm wondering how i'd throw an error not an exception if a user were to try and allocate more than 0x7fffffff bytes.
Similar to where:
error ...
1
vote
2answers
28 views
Defining const in precompiled header — How to avoid duplication
So I want to use CocoaLumberjack and am trying to insert the ddLogLevel const in my .pch file:
#if DEBUG
static const int ddLogLevel = LOG_LEVEL_VERBOSE;
#else
static const int ddLogLevel = ...
1
vote
0answers
40 views
How to make a new matrix from two or more matrix by using column values in R [duplicate]
If i have two data frames
DF1 and DF2
> DF1
Date EMMI ACT PM25
2011/02/12 12345 21 12
2011/02/14 14321 22 13
2011/02/19 12345 21 14
2011/02/24 ...
1
vote
0answers
47 views
Invalid token at start of a preprocessor expression in CoreFoundation
I'm having the following issue for the last 2 days. Whenever I try to build 1 specific app, I keep getting errors in some of the CoreFoundation classes. To be specific in the classes where one of the ...
4
votes
1answer
84 views
Conditional Compilation inside Literate Haskell
I have a literate haskell file and want to use conditional compilation. I use the bird style of literate programming. The following code does not work.
> #if MIN_VERSION_base(4,6,0)
> import ...
0
votes
0answers
21 views
How to breakpoint to post-preprocessed code in Visual Studio?
Read C/C++ source file after preprocessing , is it possible to put a breakpoint in the post-preprocessed code in Visual Studio, so one can debug C/C++ code added by macros?
0
votes
1answer
37 views
c++ #elif directive is being discarded
I am trying to create a type declaration based on boundaries
template<class B>
struct IntDecl {
enum {
L = B::_l, U = B::_u
};
#if (L >=0 && U <=255)
typedef char Type;
...
2
votes
2answers
53 views
C macro: concatenate symbols conditonally
I have
#define A_T 1
#define B_T 2
int x_a = 1, x_b =2;
How can I define a macro, which can concatenate the suffix _a and _b to the var name?
for example, something like this
#define A_T_SUF _a
...
1
vote
0answers
37 views
interface custom preprocessor task in WP7 project compilation by modying the csproj file
I have a Visual Studio solution with 2 Windows Phone 7 projects. One is the main project, the other links its xaml pages from the first.
I try to modify the .csproj file of the second project in ...
0
votes
1answer
84 views
SASS: normalize.css works, but does not show up in compiled CSS file?
I am just taking my first steps into the SASS-world. I set up everything, created a new project and downloaded the SASS port of normalize.css.
Inside the folder that holds all my SASS files, I have ...
0
votes
1answer
59 views
How to handle multilevel includes in c?
I have second level include that is giving me grief:
Undefined first referenced
symbol in file
function2 /var/tmp//ccAPaWbT.o
...
0
votes
1answer
13 views
SCSS if directive: how to pass multple variables?
How would I write this code so I check for both the truthiness of $text-shadows as well as $shadows?
.btn {
@if $text-shadows {
@include text-shadow-black;
}
@if $shadows {
@include ...
1
vote
3answers
60 views
Refactor regular C++ code pattern
Summary: I'm trying to see if I can refactor some C++ code that has a regular pattern to make it easier to update and maintain.
Details:
I have some code that creates thread local counters to keep ...
2
votes
1answer
82 views
Code generation with macros: Class with members and constructor
Let's say I want to define classes of the following structure:
struct MyClass {
int x;
bool y;
float z;
MyClass(QVariantMap data) : x(data["x"]), y(data["y"]), z(data["z"]) {}
};
As ...
0
votes
1answer
11 views
Adjust data vector to have certain variance
I have a set of integers x, 0<=x<=255
I need to transform this data in that way that :
Average of values in set == 0
Variance == 1
I can meet first condition with:
array arr[];
av = ...
0
votes
0answers
19 views
CSS preprocessor / compiler to identify class name and id conflicts
Is there a CSS preprocessor / compiler that will identify class name and id conflicts that might occur by accident on a large code base? Of course, some might be intentional, but some might not be ...
0
votes
1answer
22 views
Cocoa preprocessor exit file
I've seen some compilers that lets you stop reading the file where ever in the file you want
and I want to know if obj-c has such thing here's an example, so you can understand:
#ifndef __OBJC__ // ...