Oracle Pro-C supports long long data type?

W

wenmang

Hi,
I am using following Oracle Proc-C compiler:
Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006

(c) Copyright 2000 Oracle Corporation. All rights reserved.

I like to use "long long" integer type(64 bit), but it seems that
Oracle doesn't like it after execution, and giving me error code -1460,
any idea about this?
thx
 
E

ed

I am using following Oracle Proc-C compiler:
Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006

(c) Copyright 2000 Oracle Corporation. All rights reserved.

I like to use "long long" integer type(64 bit), but it seems that
Oracle doesn't like it after execution, and giving me error code
-1460, any idea about this?

What does

sizeof( long long int ) * 8 report?

Should be 64. If Oracle cannot support bigint(64, or 128) bits wide,
then it's got right to complain.

Can you give a sample of the error? Also, what's wrong with the GNU
compiler?
 
?

=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=

ed said:
What does

sizeof( long long int ) * 8 report?

Should be 64.

Only if char is 8 bits. That is not always the case. For instance,
many DSPs have 32-bit char.
 
K

Keith Thompson

I am using following Oracle Proc-C compiler:
Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006

(c) Copyright 2000 Oracle Corporation. All rights reserved.

I like to use "long long" integer type(64 bit), but it seems that
Oracle doesn't like it after execution, and giving me error code -1460,
any idea about this?

If a compiler doesn't support long long, it should fail to compile any
program that uses it. If you're getting a runtime error, something
else is going on. Perhaps the compiler supports long long but the
runtime library doesn't. We have no idea what "error code -1460"
might mean, and we can't guess what the problem is without seeing
actual code.

Try these programs:

========================================
#include <stdio.h>
#include <limits.h>
int main(void)
{
printf("long long is %d bits\n", (int)sizeof(long long) * CHAR_BIT);
return 0;
}
========================================
(output should be "long long is 64 bits")

========================================
#include <stdio.h>
int main(void)
{
long long x = 42;
printf("x = %d\n", (int)x);
return 0;
}
========================================
(output should be "x = 42")

========================================
#include <stdio.h>
#include <limits.h>
int main(void)
{
long long x = LLONG_MAX;
printf("x = %lld\n", x);
return 0;
}
========================================
(output should be "x = 9223372036854775807")

The correct output may vary in the unlikely event that long long is
bigger than 64 bits.
 
C

CBFalconer

I am using following Oracle Proc-C compiler:
Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006

(c) Copyright 2000 Oracle Corporation. All rights reserved.

I like to use "long long" integer type(64 bit), but it seems that
Oracle doesn't like it after execution, and giving me error code
-1460, any idea about this?

I suggest you look up that error in your Oracle documentation.
Then take appropriate action. I doubt that that compiler is C99
compliant. Or it may need another library to execute such things.

--
Some informative links:
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html
 
C

Chuck Dillon

Hi,
I am using following Oracle Proc-C compiler:
Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006

(c) Copyright 2000 Oracle Corporation. All rights reserved.

I like to use "long long" integer type(64 bit), but it seems that
Oracle doesn't like it after execution, and giving me error code -1460,
any idea about this?
thx

<Point of Clarification>
For the benefit of group members who've responded. Pro-C is a
precompiler. You write C code with embedded SQL statements as per the
Pro-C spec. Then use Pro-C to precompile the code to generate pure C
with the SQL replaced with calls to Oracle's libraries and then compile
the C.
</Point of Clarification>

For the OP...

<insert from the 8.1.7 Pro-C programmer's manual>
Table 4-4 shows the C datatypes and the pseudotypes that you can use
when declaring host variables. Only these datatypes can be used for
host variables.
Table 4-4 C Datatypes for Host Variables
C Datatype or Pseudotype Description

char single character

char[n] n-character array (string)

int integer

short small integer

long large integer

float floating-point number

double floating-point number

VARCHAR[n] variable-length string
</insert>

"long long" is not supported. You can use them if you do the
conversion youself through a char[]. To store you sprintf to a char[]
host variable and use the char[] in the SQL. When fetching fetch into
a char[] host variable and then sscanf (or other) to convert the string
to long long.

-- ced
 
T

Thomas Dickey

In comp.unix.programmer Chuck Dillon said:
(e-mail address removed) wrote:
<Point of Clarification>
For the benefit of group members who've responded. Pro-C is a
precompiler. You write C code with embedded SQL statements as per the

It's useful here to distinguish between a precompiler and a preprocessor.

Pro*C parses the code to extract type information from it. Generally
speaking, Pro*C's parser is a little fragile (has been slow to incorporate
nicities such as allowing user's #define's).
"long long" is not supported. You can use them if you do the

"long long" is a C9X feature, and Oracle 8.1.7 (note the copyright date)
is rather old. It would be interesting to see if a current version of
Oracle's Pro*C recognizes long long.
 
W

wenmang

Thanks Tom, that is what I want to know. I did used Oracle Proc-C
precompiler to do pre-compilation but it cannot inteprete long long
correctly and it treats "long long" as long instead which is incorrect.
 
T

Thomas Dickey

In comp.unix.programmer [email protected] said:
Thanks Tom, that is what I want to know. I did used Oracle Proc-C
precompiler to do pre-compilation but it cannot inteprete long long
correctly and it treats "long long" as long instead which is incorrect.

But it's an old version.
A more recent version, e.g., one released after C9X, might support long long.

Oracle 10 has been available for a while.
 
W

wenmang

We are using the Oracle pre-complier as stated in my original question.
Until the upgrade of pre-compiler for our system, it is impossible for
us to use long long at his point. thx anyway.
 
C

Chuck Dillon

Thomas said:
"long long" is a C9X feature, and Oracle 8.1.7 (note the copyright date)
is rather old. It would be interesting to see if a current version of
Oracle's Pro*C recognizes long long.

The 10g Pro*C manual describes support for the same "host variable"
datatypes as 8.1.7. IOW, still no long long support.

-- ced
 
S

Simon Biber

ed said:
What does

sizeof( long long int ) * 8 report?

Should be 64.

No. It may be more or less than 64.

For example, it may be more than 64 if 'long long' has more than 64
bits. This is quite consistent with the following types:
8-bit char (1 byte)
16-bit short (2 bytes)
32-bit int (4 bytes)
64-bit long (8 bytes)
128-bit long long (16 bytes)
So sizeof(long long)*8 == 128 in this case.

It may be less than 64 if the platform has CHAR_BIT greater than 9.

This is consistent with the following types:
10-bit char (1 byte)
20-bit short (2 bytes)
20-bit int (2 bytes)
40-bit long (4 bytes)
70-bit long long (7 bytes)
So sizeof(long long)*8 == 56 in this case.

Or even:
32-bit char (1 byte)
32-bit short (1 byte)
32-bit int (1 byte)
32-bit long (1 byte)
64-bit long long (2 bytes)
So sizeof(long long)*8 == 16 in this case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top