HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- #define multiline problem - hpux newbie
Operating System - HP-UX
1828976
Members
2227
Online
109986
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
05-14-2001 04:18 AM
05-14-2001 04:18 AM
#define multiline problem - hpux newbie
Hello,
am using the aCC compiler (A.03.27) to port code originally from sun to hpux. Am getting errors for a #define statement that has multiple lines. The following code snippet generates compiler errors.
#define ErrorIntercept() catch (Error &__e__) { __e__.Report(); throw; }catch(std::bad_alloc&) { Error __e__(Error::OUT_OF_MEMORY); __e__.Report(); throw; } catch(...) { Error __e__(Error::EXCEPTION); __e__.Report(); throw; }
And here are the compiler errors
Error 19: "Error.h", line 171 # Unexpected 'catch'.
catch (Error &__e__) ^^^^^
Error 92: "Error.h", line 171 # Character '\' (value 92) was unexpected.
catch (Error &__e__) ^
Error 19: "Error.h", line 171 # Unexpected 'Error'.
catch (Error &__e__) ^^^^^
Error 92: "Error.h", line 172 # Character '\' (value 92) was unexpected.
{ ^
Error 24: "Error.h", line 172 # '[' expected instead of '{'.
{ ^
Error 92: "Error.h", line 173 # Character '\' (value 92) was unexpected.
__e__.Report(); ^
Error 24: "Error.h", line 173 # '(' expected instead of ';'.
__e__.Report(); ^
Error 92: "Error.h", line 174 # Character '\' (value 92) was unexpected.
throw; ^
Error 22: "Error.h", line 174 # Syntax error.
throw; ^
Error 92: "Error.h", line 175 # Character '\' (value 92) was unexpected.
} catch(std::bad_alloc&) ^
Error 92: "Error.h", line 176 # Character '\' (value 92) was unexpected.
{ ^
Error 92: "Error.h", line 177 # Character '\' (value 92) was unexpected.
Error __e__(Error::OUT_OF_MEMORY);
If I put the entire code snippet on one line it compiles without a hitch. Any help please?
am using the aCC compiler (A.03.27) to port code originally from sun to hpux. Am getting errors for a #define statement that has multiple lines. The following code snippet generates compiler errors.
#define ErrorIntercept() catch (Error &__e__) { __e__.Report(); throw; }catch(std::bad_alloc&) { Error __e__(Error::OUT_OF_MEMORY); __e__.Report(); throw; } catch(...) { Error __e__(Error::EXCEPTION); __e__.Report(); throw; }
And here are the compiler errors
Error 19: "Error.h", line 171 # Unexpected 'catch'.
catch (Error &__e__) ^^^^^
Error 92: "Error.h", line 171 # Character '\' (value 92) was unexpected.
catch (Error &__e__) ^
Error 19: "Error.h", line 171 # Unexpected 'Error'.
catch (Error &__e__) ^^^^^
Error 92: "Error.h", line 172 # Character '\' (value 92) was unexpected.
{ ^
Error 24: "Error.h", line 172 # '[' expected instead of '{'.
{ ^
Error 92: "Error.h", line 173 # Character '\' (value 92) was unexpected.
__e__.Report(); ^
Error 24: "Error.h", line 173 # '(' expected instead of ';'.
__e__.Report(); ^
Error 92: "Error.h", line 174 # Character '\' (value 92) was unexpected.
throw; ^
Error 22: "Error.h", line 174 # Syntax error.
throw; ^
Error 92: "Error.h", line 175 # Character '\' (value 92) was unexpected.
} catch(std::bad_alloc&) ^
Error 92: "Error.h", line 176 # Character '\' (value 92) was unexpected.
{ ^
Error 92: "Error.h", line 177 # Character '\' (value 92) was unexpected.
Error __e__(Error::OUT_OF_MEMORY);
If I put the entire code snippet on one line it compiles without a hitch. Any help please?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 06:04 AM
05-14-2001 06:04 AM
Re: #define multiline problem - hpux newbie
Hi Steve,
Sorry, the aCC preprocessor documentation clearly states that macros cannot span lines.
However, you can use the "/" (Which must be the last character on the line) as a continuation.
e.g.
#define swap(a,b,temp) { temp = a; a = b; b = temp; }
You are the victim of a feature.
Regards, Clay
Sorry, the aCC preprocessor documentation clearly states that macros cannot span lines.
However, you can use the "/" (Which must be the last character on the line) as a continuation.
e.g.
#define swap(a,b,temp) { temp = a; a = b; b = temp; }
You are the victim of a feature.
Regards, Clay
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 07:39 AM
05-14-2001 07:39 AM
Re: #define multiline problem - hpux newbie
Hi Steve, after looking at my reply, I noticed that my response lacked the backslashes though I did insert them. It's possible your original posting suffered the same fate. I did try using the backslashs on an aCC preprocess and it worked just fine.
Clay
Clay
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 07:56 AM
05-14-2001 07:56 AM
Re: #define multiline problem - hpux newbie
Clay,
I tried your forward slash continuation character for my code and still no luck. I looked at the 3.27 doc and found the following:
"NOTE: The replacement-list must fit on one line. If the line becomes too long, it can be broken up into several lines provided that all lines but the last are terminated by a "\" character. The following is an example.
#define mac very very longreplacement string
The "\" must be the last character on the line. You cannot add any spaces or comments after it."
Notice that the doc says to use a backslash. Neither convention works for me. If I look at the standard includes, I see backslash continuation characters used throughout. Is there a compiler switch that I need to implement this behavior? My current settings are "-c +z +p -AA +DAportable +DD32 -DHPUX -D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE -D_RWSTD_MULTI_THREAD -D_RWSTD_TEMPLATE"
Thanks for all your help...
I tried your forward slash continuation character for my code and still no luck. I looked at the 3.27 doc and found the following:
"NOTE: The replacement-list must fit on one line. If the line becomes too long, it can be broken up into several lines provided that all lines but the last are terminated by a "\" character. The following is an example.
#define mac very very longreplacement string
The "\" must be the last character on the line. You cannot add any spaces or comments after it."
Notice that the doc says to use a backslash. Neither convention works for me. If I look at the standard includes, I see backslash continuation characters used throughout. Is there a compiler switch that I need to implement this behavior? My current settings are "-c +z +p -AA +DAportable +DD32 -DHPUX -D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE -D_RWSTD_MULTI_THREAD -D_RWSTD_TEMPLATE"
Thanks for all your help...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP