[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3478.0. "How can I paste long string tokens together?" by STAR::DANTONI () Fri Mar 07 1997 16:17

I'm getting a "Missing ;" error when compiling the following code using 
DEC C++ V5.5-017 on OpenVMS ALPHA V7.1:

#define L_CHAR L
main() {
const wchar_t buf[] = L_CHAR"abc";
}

The preprocessed output (using /PREPROCESS_ONLY) shows that a whitespace is 
being inserted between the L and the string "abc" which causes the error.

$ cxx test /preproc=sys$output:
# 1 "WORK1:[DANTONI]TEST.CXX;6"

main() {
const wchar_t buf[] = L "abc";
}

Is there some way to do this substitution without getting the whitespace?
T.RTitleUserPersonal
Name
DateLines
3478.1##DECCXL::WIBECANThat's the way it is, in Engineering!Fri Mar 07 1997 16:397
You could do this:

	#define L_STRING(x) L ## x

	const wchar_t buf[] = L_STRING("abc");

Note the use of the token pasting operator "##" in the macro definition.
3478.2FixedSTAR::DANTONIFri Mar 07 1997 18:481
Thanks. This syntax fixed the problem.