define

where is this defined?

Attempting to disable BSTR caching: SetOaNoCache(); VC++ compiler build output: 'SetOaNoCache': identifier not found Don't want to use: OANOCACHE=1 Question: Where is SetOaNoCache defined - header file? ...

Looking for DependencyProperty.Register shortcut.

Defining WPF properties is too long: public static readonly DependencyProperty FooProperty = DependencyProperty.Register("Foo", typeof(string), typeof(FooClass), new PropertyMetadata("Foooooo")); I have a helper method, making it a bit shorter: public static readonly DependencyProperty FooProperty = WpfUtils.Property<string, Foo...

Is there a strict definition for the words define, declare and assign?

I tend to use the words define, declare and assign interchangeably but this seems to cause offense to some people. Is this justified? Should I only use the word declare for the first time I assign to a variable? Or is there more to it than that? ...

C2065 undeclared identifier while assigning a define to an int

Hi, I have a small problem with a define. I want to assign it to an integer variable but the compiler says it's undeclared. Here's what the code looks like: defines.h #ifndef DEFINES_H #define DEFINES_H #define MYDEFINE 2 #endif myclass.h namespace mynamespace { class myClass { int someFunction(); }; } myclass.cxx #include ...

Complete list of defines for Delphi versions

Does anyone know of a good place where I can find the complete list of version defines for all the Delphi versions, right up to Delphi 2009? ...

Delphi Region compiler directive - backwards compatible unit files?

Given the desire to use the useful Region compiler directive in unit files, what's the best approach to allow these same units from being used in previous versions of Delphi? There doesn't seem to be a 'decent' approach. (Desired IDE version is Delphi 7) I like having Regions above the method definitions to hide/display the method defi...

Indenting #defines

Hi all, I know that #defines etc. are normally never indented. Why? I'm working in some code at the moment which has a horrible mixture of #defines, #ifdefs, #elses, #endifs, #etc. All these often mixed in with normal C code. The non-indenting of the #defines makes them hard to read. And the mixture of indented code with non-indented...

Can we use more than one mock object in a unit test?

hello, i have read many articles about unit testing.. Most of the articles said that we should not use more than one mock object in a test..but i can't understand why :s sometimes we really need more than one mock object in a test.. ...

Can't access a #defined constant in C

This is a C program that I was using, in the header file I define an offset: #define LDR_DATA_PATHFILENAME_OFFSET 0x24 // MODULE_ITEM.PathFileName Later in the program I use it as following: pImageName = (PUNICODE_STRING)( ((DWORD)(pUserModuleListPtr)) + (LDR_DATA_PATHFILENAME_OFFSET-dwOffset)); When inspecting the value of ...

Cocoa: I need help with some code?

Hello, I was going through some code that I downloaded off the internet (Got it here) I am confused with this line of code... What exactly is it doing? #define N_RANDOM_WORDS (sizeof(randomWords)/sizeof(NSString *)) Here is the array of "randomWords": static NSString *randomWords[] = { @"Hello", @"World", @"Some", @"Random", @"Word...

What is the possible use for "#define for if (false) {} else for"?

In another question, I just spotted this little pearl of C wisom: #define for if (false) {} else for which caused MSVC to spit out "constant expression" warnings for a quite valid statement: for (int i = 0; i <= 10; i++) {...} I understand why MSVC is complaining because it expands to: if (false) {} else for (int i = 0; i <= 10; i...

Source functions are not loaded into current file

<script language="JavaScript1.2" src="aj.js"> I am calling function a() for my image onload event .but i am getting the error - function a() [a.js has function] is not defined. How to resolve this issue ...

Access speed to the fixation value in PHP

Are direct access and constant function which high-speed?( or less memory , cpu) define("FOO","VAL"); print FOO; print constant(FOO); Could you give me a sample cord and the reason , so I am happy. edit: I'm sorry Misunderstood it very much print FOO or print constant(FOO) Which is high-speed? ...

Can you expand #define's into string literals?

Is there a way to get the C++ pre processor to expand a #define'ed value into a string literal? for example: #define NEW_LINE '\n' Printf("OutputNEW_LINE"); //or whatever This looks to me like it should be possible as it's before compilation? Or is there a better design pattern to achieve this kind of behaviour (without resorting to...

Is the sizeof(enum) == sizeof(int), always ?

Is the sizeof(enum) == sizeof(int), always ? Or is it compiler dependent? Is it wrong to say, as complier are optimized for word lengths (memory alignment) ie y int is the word-size on a particular complier.Does it means that there is no processing penalty if i use enums, as they would be word aligned. Is it not better if i put all th...

Defining Binary Macros in C++

Hi all, Can someone explain why the following error happens: #define bla "\xA" char a [2] = {0}; memcpy (a,bla,1); // a[0] = 0x0a <- Correct //a[1] = bla; // '=' : cannot convert from 'const char [2]' to 'char' Thanks, RM ...

What c preprocessor macros have already been defined, gcc?

In gcc, wow can I check what C preprocessor definitions are in place during the compilation of a C program, in particular what standard or platform-specific macrodefinitions are defined? ...

Detect compiler with #ifdef

I'm trying to build a small code that works across multiple platforms and compilers. I use assertions, most of which can be turned off, but when compiling with PGI's pgicpp using -mp for OpenMP support, it automatically uses the --no_exceptions option: everywhere in my code with a "throw" statement generates a fatal compiler error. ("sup...

Import active preprocessor symbols from file into Eclipse CDT

I'm using Eclipse CDT for a C project with custom makefiles, and I want to use the inactive code highlighting as proposed in the answers to question 739230. The automatic discovery of active/defined symbols does not work for my makefiles. Instead I have created a text file for each build target listing the active symbols. So my question...

How to run code upon class definition (not object instantiation)

I'm looking for a way to transparently run code when a class is defined - more importantly, when the class is extended. For example, if I have: class A { function define() { echo "A has been defined!\n"; } __magicDefine { define(); } } class B extends A { } I'd like that to print "A has been defined!\n". Is this i...