help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conversion warning


From: Paul Pluzhnikov
Subject: Re: conversion warning
Date: Thu, 20 Sep 2007 16:08:34 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"BobR" <removeBadBobR@worldnet.att.net> writes:

> Alexandru Mosoi wrote in message...
>> supposing that I have the following lines:
>> 
>> long long a = 12345678901234567890LL;
>> int b = a;
>> 
>> how can I make g++ (4.1.2) issue an warning because of loss of
>> precision?
>> 
>
> Use -ansi -pedantic.

int main()
{
    unsigned long long a = 12345678901234567890ULL;
    int b = a;
    return 0;
}

$ /usr/local/gcc-4.2.1/bin/g++ -ansi -pedantic t.c
t.c:3:28: warning: use of C99 long long integer constant
t.c: In function 'int main()':
t.c:3: error: ISO C++ does not support 'long long'

$ /usr/local/gcc-4.2.1/bin/gcc -ansi -pedantic t.c
t.c: In function 'main':
t.c:3: warning: ISO C90 does not support 'long long'
t.c:3:28: warning: use of C99 long long integer constant

Perhaps you should try your suggestions before suggesting them?

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]