QueryCAT Logo
Search 5,000,000+ questions and answers.

Frequently Asked Questions

How can I write a cpp macro which takes a variable number of arguments?

Infrequently Asked Questions in comp.lang.c
Shouldn't the following code: #define ROSE 1 #define CHRYSANTHEMUM 2 #define RHODODENDRON 3 #define WATER_LILY 4 printf("%d\n", CHRYSATHNEMUM);

How can I write a function that takes a variable number of arguments?

Infrequently Asked Questions in comp.lang.c
By declaring it with a variable number of arguments in the prototype. Use only the arguments declared at any given time. Redefine printf; the call to ''printf'' inside yours will be resolved to the library version, because the C language doesn't allow recursion.

How can I write a macro which takes a variable number of arguments?

Frequently Asked Questions: C Language (abridged)
Here is one popular trick. Note that the parentheses around printf's argument list are in the macro call, not the definition. #define DEBUG(args) (printf("DEBUG: "), printf args) if(n != 0) DEBUG(("n is %d\n", n));

What's the best way to write a multi-statement cpp macro?

The C Language FAQ
The usual goal is to write a macro that can be invoked as if it were a single function-call statement. This means that the "caller" will be supplying the final semicolon, so the macro body should not. The macro body cannot be a simple brace- delineated compound statement, because syntax errors would result if it were invoked (apparently as a single statement, but with a resultant extra semicolon) as the if branch of an if/else statement with an explicit else clause.

How do I send a variable number of arguments to a method, or get multiple return values back?

Java Programmer's FAQ
Easy) Use method overloading to support different parameters. This makes things easy on the caller but can get out of hand if you want to support a wide number and variety of parameter types. You should ask yourself if your code design is well-organized if you need to do this. More complicated) Use arrays. It's possible to declare arrays inline as shown below: foo("A param", new Object[] {"param3", "param4", new Integer(5)} ); // ... void foo(String param1, Object param2[]) { System.out.

Question: What internal variable can I use to read and write ASCII?

FAQ's Frequently Asked Questions
Answer: The Link Variables are the only internal variables that will accept ASCII data. You must use the suffix ":A" on the link variable to allow the link variable to store ASCII data. For example: Link\State:A = "On"

What is CPP?

Life Savings - CPP_FAQs
Sixteen million Canadians contribute to or benefit from the Canada Pension Plan. Participation is mandatory for employees, employers, and self-employed persons of all provinces, except Quebec. Quebec has the Quebec Pension Plan (QPP). For more information on Quebec visit http://www.rrq.gouv.qc.ca/an/rente/11.htm

How can I write a macro to change the password of my project?

Excel 97/2000 Developer FAQ: Part 2
You can't. The protection elements of a VBA project are not exposed in the object model. Most likely, this was done to make it more difficult for password cracking software. If this line is included at the top of a module, it means that you must declare every variable before you use it (which is a good idea).

How do I write a macro that expands into something containing ellipses (...)?

scheme-faq-macros
R5RS macros can produce output containing ellipses if there are ellipses in the input, i.e. at the place of macro usage. However, standard R5RS macros cannot introduce ellipses due to their special syntactic status in macro template. Therefore a number of Schemes implement extensions for quoting ellipses. Typically this is done using (... ...). This feature is particularly useful when defining macros that expand into other macro definitions. See here.

Can one write a macro that substitutes occurrences of identifiers?

scheme-faq-macros
Standard R5RS macros only expand on the operator (i.e. the first) position in a list datum. You cannot, for instance, define a macro like this: (define-syntax foo (syntax-rules () (foo (get-foo)))) Kent Dybvig's macro package (see here), which is also part of Chez Scheme, extends R5RS macro syntax to permit the above.

How can I write a generic macro to swap two values?

C Preprocessor
There is no good answer to this question. If the values are integers, a well-known trick using exclusive-OR could perhaps be used, but it will not work for floating-point values or pointers, or if the two values are the same variable. (See questions 3.3b and 20.15c.) If the macro is intended to be used on values of arbitrary type (the usual goal), any solution involving a temporary variable is problematical, because: It's hard to give the temporary a name that won't clash with anything.

How can I do calculations in a macro?

FAQ - iMacros
But instead of doing calculations in the macro, you can perform the calculations inside a script (e.g. Visual Basic Scripting, VBS). This allows you to use all kinds of more sophisticated calculations, loops (e.g. for....next loops) or conditional logic (e.g. if/then) for automating your web tasks. You can then use iimSet of the Scripting Interface to send values to a macro and the EXTRACT command to return values from a macro to the script. The file random-numbers.

What are the arguments on the other side?

FAQ
Some of those who oppose repeal of the GPO and WEP cite cost as a factor. Others believe that allowing a person to receive both a full government pension and Social Security survivor/dependent or earned benefits would constitute “double dipping.” NEA believes such a scenario should be treated no differently than receipt of a private pension and Social Security benefit.

How do I study more effectively? Write better briefs? Practice oral arguments?

Frequently Asked Questions
Make an appointment with Jill Miller, the Assistant Dean for Student Affairs or Chris McLaughlin, Director of Academic Advising. They can give you some pointers and review your technique on a sample exam for you.

Who takes it upon themselves to write a FAQ?

Banterist - Frequently Asked Questions FAQ
Anyone who has too much free time and feels they know a lot about the subject, be it Martin Van Buren or Flamenco.

How does the number of "takes per animal" differ from the total number of takes?

Marine Mammal Permits FAQs - Office of Protected Resources -...
The number of "takes per animal" refers to the number of times an individual animal is "harassed", hunted, captured, or collected. The "total number of takes" refers to the number of individual animals harassed, hunted, captured, killed or collected. For example, Whale City submits an application to NOAA Fisheries to conduct biopsy sampling on sperm whales for the purpose of contaminant analysis.

How do I write information to the output window in a debug build, similar to VC6's TRACE macro?

Debugging - Windows Forms FAQs
You can use the Console.Write and Console.WriteLine methods from within a Windows Forms project to do this. The class DefaultTraceListener is used to implement this functionality. When your application is launched from Visual Studio in Debug mode, you...
More Questions >>

© Copyright 2007-2013 QueryCAT
About • Webmasters • Contact