Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What does the C syntax /##/ mean?

Posted on 2006-10-30
3
Medium Priority
?
203 Views
Last Modified: 2010-04-15
This is the whole macro:

#if (ducCAN1_MODE_CHKPARAM == 0)
#define PRM /##/
#else
#define PRM
#endif

Thank you very much

Richard
0
Comment
Question by:Actia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Assisted Solution

by:callrs
callrs earned 300 total points
ID: 17832630
PRM could be defined as any string besides /##/. Do you have the code where PRM is actually used? That would give a clue as to what /##/ is being used for.

More on #define: http://www.sysprog.net/cdefine.html
0
 
LVL 84

Accepted Solution

by:
ozo earned 1200 total points
ID: 17832664
6.10.3.3 The ## operator
Constraints
A## preprocessing token shall not occur at the beginning or at the end of a replacement
list for either form of macro definition.
Semantics
If, in the replacement list of a function-like macro, a parameter is immediately preceded
or followed by a ## preprocessing token, the parameter is replaced by the corresponding
argument’s preprocessing token sequence; however, if an argument consists of no
preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
instead.148)
For both object-like and function-like macro invocations, before the replacement list is
reexamined for more macro names to replace, each instance of a ## preprocessing token
in the replacement list (not from an argument) is deleted and the preceding preprocessing
token is concatenated with the following preprocessing token. Placemarker
preprocessing tokens are handled specially: concatenation of two placemarkers results in
a single placemarker preprocessing token, and concatenation of a placemarker with a
non-placemarker preprocessing token results in the non-placemarker preprocessing token.
If the result is not a valid preprocessing token, the behavior is undefined. The resulting
token is available for further macro replacement. The order of evaluation of ## operators
is unspecified.
EXAMPLE In the following fragment:
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
#define join(c, d) in_between(c hash_hash d)
char p[] = join(x, y); // equivalent to
// char p[] = "x ## y";
The expansion produces, at various stages:
join(x, y)
in_between(x hash_hash y)
in_between(x ## y)
mkstr(x ## y)
"x ## y"
In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
this new token is not the ## operator.
0
 
LVL 30

Expert Comment

by:callrs
ID: 17833095
Thanks for the grade.

But without a plain-english explanation of what /##/ in particular is for, I'm also (still) lost lol.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question