define

Multiple (define)s in a CL style macro [scheme]

I'm currently learning how to write CL style macros (define-macro) in Scheme. As a simple example, I wrote a struct macro that defines functions like make-thing, thing?, thing-field accessors and so on. Now I'd like to combine multiple defines in a single macro, but only the last one is actually used. Currently I'm using eval to define ...

how does this address (0x00000400) = 1024

Im working in C++ and I have a #define VAL 0x00000400. when I set a variable equal to the define: int value = VAL; when I run through the debugger is shows the variable value = 1024. could someone explain how that turns into 1024? Maybe some links to memory address info, #define info, or something relevant. Thanks ...

How to add a parameter to a formatted string function call via a #define function

Hi, I want to create macros that will insert a parameter into a function call. For example, I have function Action() declared below. Action takes as it's inputs an enum for the state number and a formatted string with optional args for the string. I want to define macros so that instead of calling Action( ActionState1, "someText %d"...

How do I #define an array in C?

Is the following syntax to define an array valid syntax in C? #define array[] { \ for (j=0; j<N_frequencysteps;j++) \ { \ array[j] = (function); \ } \ } If not, how do I define an array in C? ...

Strange #define in Template?

Hello, I've got a small bit of code from a library that does this: #define VMMLIB_ALIGN( var ) var template< size_t M, typename T = float > class vector { ... private: // storage VMMLIB_ALIGN( T array[ M ] ); }; And you can call it by doing //(vector<float> myVector) myVector.array; No parenthesis or anything. what? Afte...

Accessing a defined constant returns messed up characters - help

This is strange I have a constant defined as such: define("RJ_FILES_PATH", RJ_SITE_DIRECTORY."\assets\files\\"); However when I try to access the constant in code I get this weird result on my localhost.. C:\wamp\www\my.app\assetsiles\2688 The \f is replaced by a square indicating it as an unrecognised character. Whats happening be...

#define file type

Is #define LBitmap std::list < CBITMAP *> a good practice? Edit: Alright, what can I do to convince my boss that this is bad practice? ...

Document complex #define rules with doxygen

Hi, we use #define rules like that to define a function (please don't ask me what they're doing exactly and why we are doing it that way.. they tell me it's less work to write, but I can't imagine that..): // Format // CBDefine(<class>,<Type>,<method>) // Beispiel: // CBDefine(CModEV30,CToolBar_beforeRequeryCallback,VorLadenCB) #defin...

Access property with define()'d token?

I'd like to do this: <?php define('X', 'attribute_name'); // object $thing is created with member attribute_name echo $thing->X; ?> Attempting $thing->X, PHP takes X to be a property of $thing, and ignores the fact (rightly so) that it's a define()'d token. That in mind, I had expected $thing->{X} to work, but no dice. The only solu...

Visual Studio: How do I create my own defined constants based on the "Configuration Manager"?

Basically, when I select the "Debug" configuration, the DEBUG constant is active. When I select the "Release" configuration, the DEBUG constant is inactive. How can I create my own configurations so that they include my own defined constants. Basically, I want it so that if I select the configuration "FOOBAR" that there is a constant FO...

SVG object drag from centre

All, Am working on an SVG application that requires an object to be moved from one location to another. I have implemented drag and drop, however, upon mousedown, I want the cursor to 'grab' the object from the centre of that object. I also want to predefine that centre point. As an example, if there is a circle, when the user clicks ...

What is a Class in python, what does it do, why is it needed?

Possible Duplicate: Do I correctly understand what a class is? Before you rant and rage and scream at me, understand that I tried searching everywhere, from google to this very site on what exactly a class in python is. I have found definitions of sorts, but have never been able to understand them fully. So here's the question...

Why do most C developers use define instead of const?

In many programs a #define serves the same purpose as a constant. For example. #define FIELD_WIDTH 10 const int fieldWidth = 10; I commonly see the first form preferred over the other, relying on the pre-processor to handle what is basically an application decision. Is there a reason for this tradition? ...

dynamic define the function name and function body with variables in python?

All, I have below functions def foo_001(para): tmp = para + 2 return tmp def foo_002(para): tmp = para * 2 return tmp def foo_003(para): tmp = para / 2 return tmp def foo_004(para): tmp = para - 2 return tmp those functions only have different in function names while the algorithm line e.g. "tmp = p...

Possible to convert an address assignment to function argument via C macro?

I am working on embedded code and attempting to convert a lot of memory-mapped register assignments to get()/set() function calls. I was wondering if it would be possible to maintain the address assignments sprinkled throughout the code, but change the #defines so they take the assignment in as a function argument. Old Way: #define MOT...

Visual C++ 2010 Underline errors in NEW files with #define not working?

Hi. Im having problems with the visual studio 2010 editor. Since today, visual studio wont underline errors anymore if i use #define like so: #ifndef TEST_H #define TEST_H class foo{ blabla } #endif If i remove the defining commands, the errors show up. The wierd thing is, i have other files in my project with the exact same setup an...