469,299 Members | 2,079 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,299 developers. It's quick & easy.

problem in unsigned long long

hi,
My code having unsigned long long int64_t;
like that.. compile error message is long followed by long is
illegal,
what is the reason for it?

Apr 9 '07 #1
9 5988
On Apr 9, 9:37 am, vadivel...@gmail.com wrote:
hi,
My code having unsigned long long int64_t;
like that.. compile error message is long followed by long is
illegal,
what is the reason for it?
Probably, you are not using a C99-compliant compiler.

Prior to C99, long long was not a standard data type, and instead was
an extension that /some/ compilers provided. Apparently, your compiler
is one that did not implement this non-standard (wrt pre-C99
standards) data type.

Apr 9 '07 #2
Thaks for immediate reply...

how to convert unsigned long long int64_t for gcc
compiler

Apr 9 '07 #3
va********@gmail.com wrote:
how to convert unsigned long long int64_t for gcc
compiler
What compiler flags are you using, which version of gcc, which platform?

You may have specified some combination that prevents gcc from
recognizing "long long" as a valid type. Make a tiny example program
and try compiling it with

gcc -std=c99 example example.c

For any fairly recent gcc on most platforms that should handle long long
types correctly.

Regards,

David Mathog
Apr 9 '07 #4
va********@gmail.com wrote:
Thaks for immediate reply...

how to convert unsigned long long int64_t for gcc
compiler
Current versions of gcc support unsigned long long and current versions
of libraries supplied with gcc have the header <stdint.hwith int64_t
defined there. If you upgrade to a current version of gcc and supplied
libraries, remove the typedef for int64_t from your code and add
#include <stdint.hto the top of your code.

Otherwise, if you continue to use a (very) old version of gcc without
long long, then you have no type available for int64_t. You can, of
course, lie and
typedef unsigned long int64_t;
but that is not recommended.

It is possible that you are compiling with flags that disable
recognition of long long. 'long long' is not in ISO C90, so compilation
with -std=c89 or its equivalent -ansi _may_ disable recognition of long
long. gcc will, unless told to treat warnings as errors, properly
handle long long but emit warnings. You want to use -std=c99.

If you are compiling without specifying the -std, your copy of gcc will
compile a language very much like C, but not quite. The version of the
nonstandard 'GNU C' language chosen will probably be -std=gnu89, which
will generate diagnostics for long long. For posting to comp.lang.c,
you always want to specify a version of standard C, -ansi or -std=c90
for the old standard, -std=c99 for an attempt at conforming to the new
standard. _Never_ post code for which GNU C is the language used, and
since not specifying a standard is the same as -std=gnu89, that is to be
avoided.
Apr 9 '07 #5
On 9 Apr 2007 06:52:50 -0700, va********@gmail.com wrote:
>Thaks for immediate reply...

how to convert unsigned long long int64_t for gcc
compiler
Your code is very likely to have something like

typedef unsigned long long int64_t;

Since your question is related to a specific compiler, you have to try
a compiler specific newsgroup. You might want to try gnu.gcc.help GCC
also has mailing lists which might be helpful.

<OT>
GCC version 3.2.2 (around four years old) supports unsigned long long.
It complains only when invoked in c89 mode.
</OT>

Have a nice day,
Pradeep
--
All opinions are mine and do not represent the views or
policies of my employer.
R Pradeep Chandran rpc AT pobox DOT com
Apr 9 '07 #6
On Apr 9, 6:37 am, vadivel...@gmail.com wrote:
>
My code having unsigned long long int64_t;
Why? What's it supposed to mean? How is int64_t defined? Do you have
<stdint.hincluded? Are you compiling in a C99-conformant (or close)
mode or something else?
like that.. compile error message is long followed by long is
illegal, what is the reason for it?
That depends on the answers to the questions above.
Apr 9 '07 #7
va********@gmail.com writes:
My code having unsigned long long int64_t;
like that.. compile error message is long followed by long is
illegal,
You have what?

If you have a declaration

unsigned long long int64_t;

then you're declaring an object "in64_t" of type "unsigned long long".
That's a bad idea, since "int64_t" is used in C99 as a type name, not
an object name.

Show us the *exact* code you're trying to compile.

If you have <stdint.h>, then you should already have a typedef for
"int64_t", and you don't need to declare it yourself. If your
compiler, in whatever mode you're invoking it in, doesn't support type
"unsigned long long", then you won't be able to use "unsigned long
long" unless you use a different compiler, or the same compiler in a
different mode.

gcc comes with extensive documentation. Try "info gcc".

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Apr 9 '07 #8
David Mathog <ma****@caltech.eduwrites:
va********@gmail.com wrote:
>how to convert unsigned long long int64_t for gcc
compiler

What compiler flags are you using, which version of gcc, which platform?

You may have specified some combination that prevents gcc from
recognizing "long long" as a valid type. Make a tiny example program
and try compiling it with

gcc -std=c99 example example.c

For any fairly recent gcc on most platforms that should handle long long
types correctly.
<OT>

I think you mean either
gcc -std=c99 example.c -o example
or
gcc -std=c99 -c example.c
The latter doesn't attempt to invoke the linker to create an
executable, but it will catch compile-time errors.
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Apr 9 '07 #9
<va********@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
Thaks for immediate reply...

how to convert unsigned long long int64_t for gcc
compiler
GCC has supported "unsigned long long" for many years; if you're not using a
version that understands it, you really need to upgrade.

That makes me wonder, though, what the actual code you're trying to use
looks like. Can you post a compilable example and the error messages you
get?

S

--
Stephen Sprunk "Those people who think they know everything
CCIE #3723 are a great annoyance to those of us who do."
K5SSS --Isaac Asimov
--
Posted via a free Usenet account from http://www.teranews.com

Apr 9 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Faheem Mitha | last post: by
7 posts views Thread by Chris Gordon-Smith | last post: by
19 posts views Thread by Chocawok | last post: by
39 posts views Thread by Martin Jørgensen | last post: by
19 posts views Thread by jacob navia | last post: by
3 posts views Thread by i3x171um | last post: by
20 posts views Thread by @$|-|. DUBEY | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.