Category "macros"

Why macros and functions work differently about same code in c

I am new to programing, and I found one interesting but difficult to find reason problem, so I am writing this post. I was trying to write swap function: When I

Can macros match against constant arguments instead of literals?

Given the macro matching example, this shows how macros can match an argument. I've made very minor changes here to use numbers: macro_rules! foo { (0 =&g

Rebinding tmux prefix to alt key

I'd like to change the tmux prefix from ctrl+b to a single key, specifically alt. Tried set-option -g prefix M, but it said bad key. Anyone know how to accompli

Using #define for a function [duplicate]

After struggling with C++ typedef and define, I've tried myself some code and here it is: #include <iostream> #include <string> #d

Logitech lua reliable Sleep

Introduction I am writing a lua script for my logitech mouse. The logitech lua api has this documentation. My script moves the mouse every x milliseconds to dra

Clojure - compiling project with Java classes that are potentially not available

I am wrapping a java library in Clojure. Depending on the java library version, some classes exist or not, so my library can fail to even compile if it can't fi

Clojure - compiling project with Java classes that are potentially not available

I am wrapping a java library in Clojure. Depending on the java library version, some classes exist or not, so my library can fail to even compile if it can't fi

Interesting C macro, how is it able to take a field within a struct and return a reference to the struct?

I saw an interesting design for a doubly-linked-list inside the Pintos operating system and I don't quite understand how it was able to achieve this behavior. I

C11 variadic macro : put elements into brackets [duplicate]

I'm looking at a macro, or more likely a combination of macros, that would achieve the following effect : BRACKET(a) => { a } BRACKET(a

Do IF and Compute in spss macros

I have the following spss syntax: DO IF SYSMIS(V5). COMPUTE V5 = LAG(V5). END IF. EXE. It works fine. However I'd like to repeat the same process for severa

<command-line>:0:3: warning: ISO C++11 requires whitespace after the macro name

I am compiling qt sources (C++) on different version of Ubuntu OS (14.04 and 16.04 LTS). The sources compile (g++) on 14.04 LTS without warnings. But on 16.04 g

Write a macro function to change the case of a string?

// I tried this code #include<iostream> using namespace std; // Function to convert characters // of a string to opposite case #define case_change(s

Looking for a complete Python script so that it runs my Macro?

I'm trying to create a Python script that opens MS Access and runs a Macro. I have the following script: import win32api,time from win32com.client import Dispat

Julia: How do I create a macro that returns its argument?

My question is quite similar to this one, but with a difference. I want to create a macro (or whatever) that behaves this way: julia> @my-macro x + 2 :(x +

Recursive macro clojure

In an attempt to better learn macros I've been playing around with a few simple examples including recreating a simplified thread-last. I'm having trouble unde

vba vlookup does not work in loop

I am working on a tool to analyse data. The data to be analyzed is manually copied into the first sheet, then I am planning to run a macro which analyzes the da

IF Statements and Conditions for iMacros Firefox

So I'm trying to make a macro to catch Pokemon from maps in this game but there if you encounter a Turf War it will show this image: As you can see the click

Macro to repeat a single character multiple number of times

I am learning about macros and I want to know that whether it is possible to create a macro that repeats a given character literal a given number of times. For

Can we have recursive macros?

I want to know if we can have recursive macros in C/C++? If yes, please provide a sample example. Second thing: why am I not able to execute the below code? Wh

gcc macro expansion of #error

I have some preprocessor code like this: #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) #if GCC_VERSION < 40503 #error Your compiler is outdated. #e