Operating System - HP-UX
1753861 Members
7544 Online
108809 Solutions
New Discussion юеВ

Large values data types: HP C/HP-UX 9000

 
SOLVED
Go to solution
Bert Verhoeven
Occasional Advisor

Large values data types: HP C/HP-UX 9000

I want to store values larger then 2.147.483647 in a variable.

When I compile I get the message:
warning 602: Integer constant exceeds its storage.

I used double, long double,... Still get the message

How can I solve this?
7 REPLIES 7
Steve Steel
Honored Contributor

Re: Large values data types: HP C/HP-UX 9000

Hi

I suspect that the compiler is unhappy about the long long assignment statement.
Change to this type:

unsigned long long x = 12345678901LL;


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
harry d brown jr
Honored Contributor

Re: Large values data types: HP C/HP-UX 9000

Bert,

what does your assignment look like, because "2.147.483647" isn't much of an integer.

live free or die
harry
Live Free or Die
harry d brown jr
Honored Contributor

Re: Large values data types: HP C/HP-UX 9000

You could to add +DD64 to your compile options.

live free or die
harry
Live Free or Die
Bert Verhoeven
Occasional Advisor

Re: Large values data types: HP C/HP-UX 9000

Just a simple example.

#include

main()
{
double x = 9999999999;

printf("%0.f\n",x);
}

Using +DD64 gives:
Can't find library for -lc

Probably need to specify a path.
harry d brown jr
Honored Contributor
Solution

Re: Large values data types: HP C/HP-UX 9000

Try this:

#include

main()
{
double howdy = 9147483649.0;
printf("%0.lf\n",howdy);

exit(0);
}


/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (test.o) was detected. The linked output may not run on a PA 1.x system.
# ./a.out
9147483649
#



live free or die
harry
Live Free or Die
Bert Verhoeven
Occasional Advisor

Re: Large values data types: HP C/HP-UX 9000

That simple...(sigh)

Tnx Harry.
harry d brown jr
Honored Contributor

Re: Large values data types: HP C/HP-UX 9000

Bert,

The "lf" is not needed in the printf, just "f" will do. The issue was the assignment, by adding the decimal portion, it forced it to convert it via the type.

live free or die
harry
Live Free or Die