How use #pragma pack() in HP unix ?

Thread Tools Search this Thread
Top Forums Programming How use #pragma pack() in HP unix ?
# 1  
Old 03-04-2002
Question How use #pragma pack() in HP unix ?


i use follow sentences in include files in SCO unix is ok.
#pragma pack(1)
struct dddd {
int iD1;
char cCh1;
#pragma pack()

but in hp-9000 unix , not ok when compiling, cc not support
#pragma pack(1)

how to settle the question ?
thank you .
# 2  
Old 03-04-2002
A "#pragma" by definition is implementation defined. A compiler is supposed to ignore a pragma that it doesn't understand. HP's c compiler does issue a warning, but it should compile.

I'm not familiar with the pragma that you are using. But I'll make a guess as to its function. It looks like your system has a choice of two ways to compile a structure. I would guess that one choice conserves memory while the other choice enhances execution speed. You won't get a choice like that on HP systems. HP's chip is designed for execution speed. But it has very strict memory alignment constraints. And so HP's compiler doesn't get a choice.

Ignore the warning or remove the pragma. If your program assumes a particular internal layout of a structure then it is not a portable program and you will probably have trouble.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

GCC Alignment pragma

Quick question for the community of GCC programmers. I have code that uses: #pragma align 4 (as an example). Now this code has compiled for many years on a few different platforms and GCC versions. Recently I got warning messages about it (using gcc 4.9.2 on Solaris) and I wondered... (0 Replies)
Discussion started by: Pug
0 Replies

2. Programming

#pragma warn codes on Sun Solaris to disable some warns?

I am not able to find warn-codes that should be used in #pragma warn -<code> directive!:wall: Could anybody advise where I can see a list of warnings with codes that (as I understand) should be 3-letters code? I have a pro-C program that produces some warnings. (Do not advise,... (4 Replies)
Discussion started by: alex_5161
4 Replies

3. Solaris

weblogic Maintenance pack

Hi ALL, I am running weblogic portal(9.2.2) on solaris and i wanted to apply maintenance pack and upgrade it to 9.2.3. Without using x-windows system how can i apply maintenance pack.? (0 Replies)
Discussion started by: gaurav183
0 Replies

4. Programming

Python, struct.pack

Hello, I found some code on line. Is a python function that bring up an Internet interface, here the code: # Get existing device flags ifreq = struct.pack('16sh', 'wlan0', 0) flags = struct.unpack('16sh', fcntl.ioctl(sockfd, SIOCGIFFLAGS, ifreq)) I'm starting... (1 Reply)
Discussion started by: Dedalus
1 Replies

5. Programming

pragma page

Hi, I have a question regarding pragma page. What is the advantage of using this pragma? Also the description tells that it is a compiler directive to start of in a new page. Does the page here refer to the page in memory where the set of code under the pragma page will be starting in a new... (3 Replies)
Discussion started by: naan
3 Replies

6. UNIX for Dummies Questions & Answers

Pack current folder

How do I pack (using tar zcvf ?) the current folder inluding all files and folders ?? I need to be sure to get all files and folders/subfolders... Later I will unpack into a new folder on a new server.. Appreciate any help.. (3 Replies)
Discussion started by: WebWatch
3 Replies

7. AIX

Aix - Service Pack

I've recently installed ServicePack1 for Tecnology_Level 9 of AIX 5.2 . The result of installation is "OK" but with oslevel -s i dont see the service pack installed .... after many research i try (with many luck!!) instfix -i|grep SP and the result : All filesets for 5200-08-01_SP... (1 Reply)
Discussion started by: BabylonRocker
1 Replies

8. Shell Programming and Scripting

Perl help!! (pack()?)

Hello everyone. I wrote a perl script to get the two answers from a value: x. By this, I want to do sqrt($x) in different precision. #!/usr/bin/perl print "Input the initial value x:\n"; chomp($x=<STDIN>); $comp=sqrt($x); $float_value=pack("f", $comp); $double_value=pack("d", $comp);... (2 Replies)
Discussion started by: Euler04
2 Replies

9. Shell Programming and Scripting

Perl + pack() + spaceing question

ok guys and gals at the moment i am perplexed (prolly cuz i been looking at it to long) but here it is. OS: sol8 perlver: 5.8.0 shell: ksh answer must be in perl!! issue: when i use pack() it packs the data at the front of the requested field space. normally it wouldnt be a problem if... (1 Reply)
Discussion started by: Optimus_P
1 Replies

10. UNIX for Dummies Questions & Answers

HP-UX UNIX Software v.10.20 Pack

What are the requirements for this software? Intel, or other. Can I use this os as a dual boot with win 2000 pro? Thanks in advance. (1 Reply)
Discussion started by: normreeves
1 Replies
Login or Register to Ask a Question