Macros are useful.
Therefore, I occasionally bemoan the absence of macros in Java and C#. Macros allow me to force in-line but allow me the code-manageability of non-macro code.
Is there any Java- or C#-based project/product somewhere out there that effectively allow macros or specifying in-line expansion.
I am thinking of something l...
I have 35 pages list of scientific references. In order to upload them to a webpage, I would like to add custom fields before and after each reference. I would also like to find italicized text and add around it.
For instance, I would like this paragraph
Alouf N., 1973. Biotope et description de Niphargus altagahizi n. sp., Amphipode...
I'm trying to detect the compiler used to compile my source code. I can easily find predefined macros to check for MSVC or GCC (see http://predef.sourceforge.net/ for example), but I cannot find any macro to check for clang.
Does someone know if clang defines a macro like __CLANG__ in order to know what is currently compiling my code ?
...
Is it possible to put a macro in a macro in c++?
Something like:
#define Something\
#ifdef SomethingElse\ //do stuff \
#endif\
I tried and it didn't work so my guess is it doesn't work, unless there's some sort of syntax that can fix it?
...
Hello guys,
I am trying to do the following. Imagine you are reading some LINQ article and you decide to copy/paste some code from the article to a newly created project. In most cases, if you directly compile you will probably get an error for missing a using directives or assembly reference. I am trying to optimize the process where I...
In Visual Studio 2008 I had a macro which would insert a snippet and input today's date in one of the replacements. When I try to run this macro in VS 2010 it doesn't work. No matter how I try it will not insert a snippet. When I try the following command:
DTE.ExecuteCommand("Edit.InvokeSnippetFromShortcut", "snippetName")
This ...
I'm trying to make a macro to make it easier to define properties.
Simplified example but at the moment I have this to provide a property with a public get and private set:
#define propertyRO(xxType, xxName)\
property xxType xxName\
{\
xxType get() {return m___##xxName;}\
void set(xxType value) {m___##xxName = v...
I am trying to open an Excel (xlsm) file via VBA. It may or may not be protected with a (known) password. I am using this code:
On Error Resume Next
Workbooks.Open filename, Password:=user_entered_pw
opened = (Err.Number=0)
On Error Goto 0
Now, this works fine if the workbook has a password. But if it is unprotected, it can NOT be ope...
I generally have ignored using macros while writing in C but I think I know fundamentals about them. While i was reading the source code of list in linux kernel, i saw something like that:
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
(You can access the re...
I've been working on a foundational c++ library for some time now, and there are a variety of ideas I've had that could really simplify the code writing and managing process. One of these is the concept of introducing some macros to help simplify statements that appear very often, but are a bit more complicated than should be necessary. ...
Is there such macro in C++ (cross-compiler or compiler-specific):
#if isclass(NameSpace::MyClass)
Would be useful.
Thank you.
...
Hi all,
I am writing a macro in MS Word which should find all highlighted text in a document and perform some action on each. I am planning a loop to do the search and manipulation part and have no problem with this portion of the code.
But I don't know how to find how many iterations I'm going to need. Is there a way to determine the nu...
I have developed two MS Word macros and assigned each an icon. I have also added a custom toolbar, named after the project, and added the two macro icons to that toolbar. Now, how do I package the whole thing (macros, icons, and custom toolbar) to send it to my customer?
...
I'm using a macro and I think it works fine -
#define CStrNullLastNL(str) {char* nl=strrchr(str,'\n'); if(nl){*nl=0;}}
So it works to zero out the last newline in a string, really its used to chop off the linebreak when it gets left on by fgets.
So, I'm wondering if I can "return" a value from the macro, so it can be called like
f...
Hi,
i Know how to use attribute deprecated to deprcate a function like this:
int old_fn () __attribute__ ((deprecated));
But how to deprecate a Macro like this:
#define OLD_MACRO 1
Thank you in advance.
Eric
...
I'm totally new on this so I want to start with something simple.
I have just an object in my Visio document and I want to display a Hello World! message whenever it's clicked.
...
Here is some C++ code I'm playing around with:
#include <iostream>
#include <vector>
#define IN ,
#define FOREACH(x,y) for(unsigned int i=0;i<y.size();i++) { x=y[i];
#define ENDFOREACH }
using namespace std;
int main()
{
vector<int> ints;
ints.push_back(3);
ints.push_back(4);
ints.push_back(5);
ints.push_back(6);
...
Possible Duplicates:
Why are there sometimes meaningless do/while and if/else statements in C/C++ macros?
do { } while (0) what is it good for?
I'm working on some C code filled with macros like this:
#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
Can anyone explain what this macro does, and w...
Hello
I'm wanting to use variables inside my macro SQL on Teradata.
I thought I could do something like the following:
REPLACE MACRO DbName.MyMacro
(
MacroNm VARCHAR(50)
)
AS
(
/* Variable to store last time the macro was run */
DECLARE V_LAST_RUN_DATE TIMESTAMP;
/* Get last run date and store in V_LA...
Hi everyone
I have a vim macro that I keep mistyping, usually when I'm trying to save something so I do it quickly and I can't work out what keys I pressed. It is annoying as it pastes some irrelevant bash code into my file so I have to undo the erroneous pasting which also undos the last thing I typed that I do want.
I was looking fo...