macros

What is the difference between macro constants and constant variables in C?

Possible Duplicate: static const vs #define in c I started to learn C in these days. And couldn't understand clearly differences between macros and constant variables. What changes when I write, #define A 8 and const int A = 8 ? ...

Error with objective-c macro

Hi guys, Im new to writing macros in Xcode and am having a problem writing my own NSLog replacement. I've been using a few examples but want to tweak them slightly, so they act more like Log4. Im trying to write a 2nd macro (or ideally just a delegate of the first) which takes a log level variable as well as the string and arguments fo...

Displaying and linking Excel objects in Publisher

I've created a lot of forms in Excel, which sum, calculate, highlight, index, etc. I can lock or unlock certain parts of it so that users can only edit the input fields, but it's nearly impossible to format Excel to anything other than a straight up grid. I have different inputs needed, in groups of different sizes, and formatting a spre...

Is there a macro that Xcode automatically sets in debug builds?

So I can write code like this: #ifdef [whatever] // do stuff that will never show up in the production version #endif ...

Help with 2 C macros

I've defined 2 macros: #define HCL_CLASS(TYPE) typedef struct TYPE { \ HCLUInt rc; \ void (*dealloc)(TYPE*); #define HCL_CLASS_END(TYPE) } TYPE; \ TYPE * TYPE##Alloc() { TYPE *ptr = (TYPE *)malloc(sizeof(TYPE)); if (ptr != NULL) ptr->rc = 1; return ptr; } The purpose of these macros...

Define not evaluating POD?

I was going over the C++ FAQ Lite online. I was browsing inlines again since I haven't found a use for them and wanted to know how the stopped the circular dependency as showed in this answer. I first tried to do the, "Why inlines are better than defines." example with the following code: #define unsafe(i) \ ( (i) >= 0 ? (i) : -(i) ...

How to programmatically enable/disable all the exceptions in visual studio.

Hi. The trivial macro like this: Private Sub SetStatusAll(ByVal enable As Boolean) Dim dbg As Debugger4 = DTE.Debugger Dim exceptionSettings As ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions") For Each exceptionSetting As ExceptionSetting In exceptionSettings exceptionSettings.SetBr...

how do i use filesystemobject in VBA?

is there something that i need to reference? how do i use this: Dim fso As New FileSystemObject Dim fld As Folder Dim ts As TextStream i am getting an error because it does not recognize these objects ...

How to get the index of a combo box in Excel spreadsheet by using VBA?

Hi, I have an Excel 2003 file. In the first sheet, I put a combo box. After that, I assign a macro to handle the change event. The macro is located a module in the VB Editor's Project Explorer box. In the macro, I want to write some lines to get the index of the combo box's selected item index. What should I write? I wrote the line I...

Objective-C Safe Casting Macro

I've written a macro in Objective-C to perform a safe cast. Here's what it looks like so far: #define SAFE_CAST(OBJECT, TYPE) ([OBJECT isKindOfClass:[TYPE class]] ? (TYPE *) OBJECT: nil) This works really well, but it'd be nice if there was a way to store OBJECT in a variable so it didn't get called twice. For instance, using the ma...

error handling in VBA

i have a sub that looks like this: Sub open_esy(filename, p As String, p1 As Integer) Dim fileLocation As String Dim iFileNum As Integer, findblank Dim letter_temp0 As String, letter0 As String, letter1 As String Dim i As Integer Dim j As Integer i = 16 If Dir("\\Tecan3\output\" & filename & "*esy") <> "" Then fileLocation = "\\Tec...

Enum vs Macro States C++

(Question is related to my previous questions here, here, here, and here). I am maintaining a very old application that was ported years ago from DOS to Windows, but a lot of the old C conventions still carry forward. The one particular convention is a setBit and clrBit macro: #ifndef setBit #define setBit(word, mask) word |= mask #en...

Using C++ templates or macros for compile time function generation

Hi all, I have a code that runs on an embedded system and it has to run really fast. I know C and macros, and this particular project is coded mostly in C but it also uses C++ templates [increasingly more]. There is an inline function: inline my_t read_memory(uint32 addr) { #if (CURRENT_STATE & OPTIMIZE_BITMAP) return readOptimiz...

How to repeat some action certain times on Vim?

In Vim, I usually want to repeat some series of commands some times. Say, I want to comment 5 lines, I would use I//<Esc>j .j.j.j.j Is there any way to repeat the last ".j" part several times? ...

How to use WPF from a Visual Studio 2010 macro?

Is it possible to call WPF from a VS2010 macro? If I try to add a reference, the PresentationFramework etc. are not there. Is there any way around this aside from writing an addin? ...

Why do I get NPE in the following code?

The following code executes as expected but gives a NullPointerException at the end. What am I doing wrong here? (ns my-first-macro) (defmacro exec-all [& commands] (map (fn [c] `(println "Code: " '~c "\t=>\tResult: " ~c)) commands)) (exec-all (cons 2 [4 5 6]) ({:k 3 :m 8} :k) (conj [4 5 \d] \e \f)) ; Output: ; Clojure 1.2.0-...

a way to omit taking names for objects that are used only to construct a final object

Suppose we have following two classes: class Temp{ public: char a; char b; }; class Final{ private: int a; char b; char c; public: Final(Temp in):b(in.a),c(in.b){} //rest of implementation }; suppose the only use of objects of Temp class is to construct objects of Final class, so I wonder if in current standard of c++...

How do I enumerate a list of Source Files with Pending Changes and get their server location?

I'm trying to write a macro that will generate a plain-text list of files changed based on the list of files in the Pending Changes pane but I can't figure out how to do it. The server location of a file is the property that is formatted like this: $/TfsName/SomeSolution/Web/SomeFolder/SomeFile1.aspx $/TfsName/SomeSolution/Web/SomeFolde...

I receive a type-mismatch error from VBA on one computer, but not on others. Why?

Hi, I have an Excel file with macro. In this file, there is a user form. In the form, there is a Textbox. I call the user form "MyForm" and the TextBox "MyTextBox". I also have a module. In this module there is a subroutine like this Sub MySub(s As String) MyForm.MyTextBox.Value = s ... End Sub On most computers, the code ab...

send-object command not to send if no records in query

I want to use the macro' "send-object command" to email the records of a bunch of queries on a daily basis, but I only want it to send the given email if there are records in the given query. if the query doesnt output any records, then I dont want that email to be sent. I know how to accomplish this by using an Acces report by setti...