- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- aCC difference between preprocessor and compiler
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2005 11:07 AM
тАО02-04-2005 11:07 AM
Example:
file test.cpp
#--------------------------------------
#define A2U(x) L#x
int main(int argc, char* argv[])
{
wchar_t* p = A2U(TEST);
return 0;
}
#--------------------------------------
Run: aCC -P test.cpp
Preprocessor result (test.i):
#--------------------------------------
int main(int argc, char* argv[])
{
wchar_t* p = L"TEST" ;
return 0;
}
#--------------------------------------
No error if this result is compiling.
Run: aCC test.cpp
Result: 2 errors
#--------------------------------------
Error 172: "test.cpp", line 5 # Undeclared variable 'L'.
wchar_t* p = A2U(TEST);
^^^
Error 20: "test.cpp", line 5 # ';' expected before '"TEST"'.
wchar_t* p = A2U(TEST);
^^^
#--------------------------------------
It looks like the result of preprocessor and compiler is different. Can anybody help me to avoid this problem?
In previous aCC releases (3.27) there was problem in preprocessor also. For above example the result was
wchar_t* p = L тАЬTESTтАЭ ;
// There is 1 space symbol between L and тАЬTESTтАЭ.
Now the preprocessor is seems to be working correctly. What about compiler? Is that correct behav
Solved! Go to Solution.
- Tags:
- preprocessing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2005 05:58 AM
тАО02-05-2005 05:58 AM
Re: aCC difference between preprocessor and compiler
aCC -P does NOT compile but only preprocesses...
What exactly do you want to do?
++Cyrille
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2005 01:06 PM
тАО02-06-2005 01:06 PM
Re: aCC difference between preprocessor and compiler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2005 06:20 PM
тАО02-06-2005 06:20 PM
Re: aCC difference between preprocessor and compiler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2005 06:28 PM
тАО02-06-2005 06:28 PM
Re: aCC difference between preprocessor and compiler
-Cyrille
int main(int argc, char* argv[])
{
wchar_t* p = L"TEST" ;
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2005 06:34 PM
тАО02-06-2005 06:34 PM
Re: aCC difference between preprocessor and compiler
[08:37:57]:attend:/home/pack
cmaucci> aCC -E -.i a.cpp
[08:37:59]:attend:/home/pack
cmaucci> cat a.i
#line 1 "a.cpp"
#line 2 "a.cpp"
int main(int argc, char* argv[])
{
wchar_t* p = L"TEST" ;
return 0;
}
[08:38:03]:attend:/home/pack
cmaucci> aCC a.i
Warning 829: "a.cpp", line 4 # Implicit conversion of string literal to 'wchar_t *' is deprecated.
wchar_t* p = L"TEST" ;
^^^^^^^
IN 2 STEPS THIS HAS COMPILED!
[08:38:06]:attend:/home/pack
cmaucci> aCC a.cpp
Error 172: "a.cpp", line 4 # Undeclared variable 'L'.
wchar_t* p = A2U(TEST);
^^^
Error 20: "a.cpp", line 4 # ';' expected before '"TEST"'.
wchar_t* p = A2U(TEST);
^^^
[08:38:11]:attend:/home/pack
cmaucci>
IN 1 STEP THIS HAS NOT COMPILED
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2005 04:58 AM
тАО02-07-2005 04:58 AM
Re: aCC difference between preprocessor and compiler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2005 08:22 PM
тАО02-08-2005 08:22 PM
Re: aCC difference between preprocessor and compiler
#--------------------------------------
#define A2U(x) L ## #x
int main(int argc, char* argv[])
{
wchar_t* p = A2U(TEST);
return 0;
}
#--------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2005 05:06 AM
тАО02-09-2005 05:06 AM
Re: aCC difference between preprocessor and compiler
This example can not be compiled. Compiler returns 4 errors...
Also preprocessor returns result as
wchar_t* p = L#TEST ;
It seems like preprocessor can not make one more step - to substitute "TEST" instead of #TEST.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2005 08:10 PM
тАО02-09-2005 08:10 PM
SolutionIf you are sure that the macro definition reads
#define
then your compiler is definitely wrong! There is nothing wrong with the syntax. I've checked it on 3 different compilers and they are all happy with it. Is your aCC patched to the latest level?
One kludge you might also try is:
#define CONCAT(x,y) x ## y
#define A2U(x) CONCAT(L,#x)
int main(int argc, char* argv[])
{
wchar_t* p = A2U(TEST);
return 0;
}
Worth a try!