HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Porting C program from MS Visual C++
Operating System - HP-UX
1833346
Members
2911
Online
110051
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
08-01-2001 06:38 AM
08-01-2001 06:38 AM
Porting C program from MS Visual C++
Hi everyone,
I have many C programs which compile under MS Visual C++ but not on HP C/ansi C or HP C++ compiler. The problem is around structures. Is there an option on either of the HP Compilers which I can use to allow these structures to work as written?
A snip of the code:
struct w_ioa_000
{
struct
{
char hipaa_manager_name_001as;
char hipaa_manager_name_001[49] /* 48 + 1 */;
char hipaa_queue_name_001as;
char hipaa_queue_name_001[49] /* 48 + 1 */;
char hipaa_exception_queue_na_002as;
char hipaa_exception_queue_name_002[49] /* 48 + 1 */;
char hipaa_mq_time_out_002as;
char hipaa_mq_time_out_002[6] /* 5 + 1 */;
};
};
Error message while compiling:
cc: "EABCL837.c", line 46: warning 500: Unnamed struct/union members are ignored.
cc: "EABCL837.c", line 44: error 1613: Zero-sized struct.
Compile line:
cc -Aa -c +z -DTARGET_HPUX -D_INCLUDE_HPUX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_POSIX_SOURCE +DAportable -I/t07/m2
10/extrn/include -o/t07/m210/extrn/src/EABCL837.o /t07/m210/extrn/src/EABCL837.c
Thoughts?
Thanks,
Tony
I have many C programs which compile under MS Visual C++ but not on HP C/ansi C or HP C++ compiler. The problem is around structures. Is there an option on either of the HP Compilers which I can use to allow these structures to work as written?
A snip of the code:
struct w_ioa_000
{
struct
{
char hipaa_manager_name_001as;
char hipaa_manager_name_001[49] /* 48 + 1 */;
char hipaa_queue_name_001as;
char hipaa_queue_name_001[49] /* 48 + 1 */;
char hipaa_exception_queue_na_002as;
char hipaa_exception_queue_name_002[49] /* 48 + 1 */;
char hipaa_mq_time_out_002as;
char hipaa_mq_time_out_002[6] /* 5 + 1 */;
};
};
Error message while compiling:
cc: "EABCL837.c", line 46: warning 500: Unnamed struct/union members are ignored.
cc: "EABCL837.c", line 44: error 1613: Zero-sized struct.
Compile line:
cc -Aa -c +z -DTARGET_HPUX -D_INCLUDE_HPUX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_POSIX_SOURCE +DAportable -I/t07/m2
10/extrn/include -o/t07/m210/extrn/src/EABCL837.o /t07/m210/extrn/src/EABCL837.c
Thoughts?
Thanks,
Tony
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2001 07:14 AM
08-01-2001 07:14 AM
Re: Porting C program from MS Visual C++
Just off the cuff -- have you tried giving a name to the encapsulated struct? That's certainly what the compiler error seems to be complaining about.
(Which also makes me wonder how you referenced those fields in Visual C++ -- I've never tried using an unlabeled struct as a field of a labeled one.)
(Which also makes me wonder how you referenced those fields in Visual C++ -- I've never tried using an unlabeled struct as a field of a labeled one.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2001 07:19 AM
08-01-2001 07:19 AM
Re: Porting C program from MS Visual C++
Hi Tony:
Sorry, there is no #pragma or compiler option
to fix? this. The fundamental problem is that as declared the nested struct has no variable associated with so that the compiler cannot calculate sizes. Moreover, there is no way to address any component of the nested struct without an associated name. Even naming the nested struct e.g struct dummy doesn't help because it does not address the space allocation (or addressing) issue.
The real fix is to make your code portable by
changed to something like this:
struct w_ioa_000
{
struct MY_STRUCT
{
char hipaa_manager_name_001as;
char hipaa_manager_name_001[49] /* 48 + 1 */;
char hipaa_queue_name_001as;
char hipaa_queue_name_001[49] /* 48 + 1 */;
char hipaa_exception_queue_na_002as;
char hipaa_exception_queue_name_002[49] /* 48 + 1 */;
char hipaa_mq_time_out_002as;
char hipaa_mq_time_out_002[6] /* 5 + 1 */;
} DUMMY;
};
If you have a large amount of code to change, you could probably do this with perl or awk.
Clay
Sorry, there is no #pragma or compiler option
to fix? this. The fundamental problem is that as declared the nested struct has no variable associated with so that the compiler cannot calculate sizes. Moreover, there is no way to address any component of the nested struct without an associated name. Even naming the nested struct e.g struct dummy doesn't help because it does not address the space allocation (or addressing) issue.
The real fix is to make your code portable by
changed to something like this:
struct w_ioa_000
{
struct MY_STRUCT
{
char hipaa_manager_name_001as;
char hipaa_manager_name_001[49] /* 48 + 1 */;
char hipaa_queue_name_001as;
char hipaa_queue_name_001[49] /* 48 + 1 */;
char hipaa_exception_queue_na_002as;
char hipaa_exception_queue_name_002[49] /* 48 + 1 */;
char hipaa_mq_time_out_002as;
char hipaa_mq_time_out_002[6] /* 5 + 1 */;
} DUMMY;
};
If you have a large amount of code to change, you could probably do this with perl or awk.
Clay
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2001 07:33 AM
08-01-2001 07:33 AM
Re: Porting C program from MS Visual C++
Thanks for the replies. Yes there is a larger amount of code to be changed. A script or Perl script was discussed, but that looks like the answer.
Thanks.
Tony
Thanks.
Tony
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