What does the C syntax /##/ mean?

Posted on 2006-10-30
Last Modified: 2010-04-15
This is the whole macro:

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

Thank you very much

Question by:Actia
  • 2
LVL 30

Assisted Solution

callrs earned 100 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:
LVL 84

Accepted Solution

ozo earned 400 total points
ID: 17832664 The ## operator
A## preprocessing token shall not occur at the beginning or at the end of a replacement
list for either form of macro definition.
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
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.
LVL 30

Expert Comment

ID: 17833095
Thanks for the grade.

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

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

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  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.

863 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

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now