473,414 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

"does not give a valid preprocessing token"... Why?

Hi All,

I have a piece of code (not written by me) that is failing on compile with
the error:
pasting "xdr_ndmp_connect_open_request" and "," does not
give a valid preprocessing token

The relevant line from the header is:
#define XDR_AND_SIZE(func) (bool_t(*)(XDR*, ...))xdr_##func##,sizeof(func)

Any and all help greatly appreciated.
Nov 14 '05 #1
3 22826
Frodo Baggins <fr************@here.com> scribbled the following:
Hi All, I have a piece of code (not written by me) that is failing on compile with
the error:
pasting "xdr_ndmp_connect_open_request" and "," does not
give a valid preprocessing token The relevant line from the header is:
#define XDR_AND_SIZE(func) (bool_t(*)(XDR*, ...))xdr_##func##,sizeof(func) Any and all help greatly appreciated.


C tokenising doesn't work like you think it does. The , (commma) that
separates function parameters is a token on its own, not part of some
greater token that comprises the entire function invocation.
In other words, your function invocation would read tokenised like this:

(
bool_t
(
*
)
(
XDR
*
,
....
)
)
xdr_func
,
sizeof
(
func
)

The ## preprocessing operator concatenates two pieces of text into one
single token. This makes the invocation read like this:

(
bool_t
(
*
)
(
XDR
*
,
....
)
)
xdr_func,
sizeof
(
func
)

See the difference? You end up with a token saying "xdr_func," (note
the comma) which is not a legal identifier, operator or punctuator.

To fix this, simply replace the second ## with a space.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Make money fast! Don't feed it!"
- Anon
Nov 14 '05 #2
Frodo Baggins <fr************@here.com> writes:
pasting "xdr_ndmp_connect_open_request" and "," does not
give a valid preprocessing token

The relevant line from the header is:
#define XDR_AND_SIZE(func) (bool_t(*)(XDR*, ...))xdr_##func##,sizeof(func)


Remove the second ##. It looks like its inclusion was a mistake.
--
Here's a tip: null pointers don't have to be *dull* pointers!
Nov 14 '05 #3
On Wed, 15 Sep 2004 18:14:31 +0000, Joona I Palaste wrote:
See the difference? You end up with a token saying "xdr_func," (note
the comma) which is not a legal identifier, operator or punctuator.

To fix this, simply replace the second ## with a space.


That was it exactly. Thank you both Joona and Ben. :)
Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stephen Oakes | last post by:
I am trying to upload an image to a server, but I get this warning: Warning: imagecreatefromjpeg(): 'filename' is not a valid JPEG file The error occurs when I am trying to create a thumbnail...
1
by: Lauchlan M | last post by:
I get the following error. Apart from the fact that it does not make any grammatical sense, what would be likely to be causing it? The background is that nxCmdDeleteErrorLogItem is a delete...
1
by: Lauchlan M | last post by:
I get the following error. Apart from the fact that it does not make any grammatical sense, what would be likely to be causing it? I have a command component 'nxCmdDeleteErrorLogItem' with the...
2
by: Tom | last post by:
I'm getting this error when I try to pass a structure to a dll. An unhandled exception of type 'System.ArgumentException' occured in Test1.exe Additional Information: Type could not be marshaled...
4
by: lisa | last post by:
I have an XML file that starts like this: <?xml version="1.0" encoding="ISO-8859-1" xmlns:fn="http://www.w3.org/2005/xpath-functions"?> <Authors> <Author> <ID>2</ID>...
9
by: larrybud2002 | last post by:
I've read about this error in this group and others from early 2006 but without any resolution, so I thought I'd bump it up to see if there's a solution. Trying to build a website on ...
2
by: shalong | last post by:
Hi all, VS 2008 is complaining that HttpWebRequest class is not in System.Net namespace I have referenced System.Net and have coded "using System.Net" I think its a setup problem rather than a...
3
by: =?Utf-8?B?Sm9uIEU=?= | last post by:
I have an interface class with maybe eight functions, defined in one workspace and am defining a class in a second workspace that derives from this interface. Unfortunately only 7 of the 8...
5
by: Phacer | last post by:
When trying to compile I get this /main.c:30: error: expected identifier or '(' before '{' token ../main.c:31: error: expected identifier or '(' before 'if' make: *** Error 1 SDL_SysWMinfo...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.