Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Problem: scanf used for double

Reply
Thread Tools

Problem: scanf used for double

 
 
Christopher Benson-Manica
Guest
Posts: n/a
 
      10-17-2003
Irrwahn Grausewitz <(E-Mail Removed)> spoke thus:

> Nope, according to ISO/IEC 9899:1999 5.1.2.2.3 and 7.20.4.3#5
> it is perfectly portable.


<dumb>So if 0 is portable, why the EXIT_SUCCESS macro?</dumb>

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
 
Reply With Quote
 
 
 
 
Irrwahn Grausewitz
Guest
Posts: n/a
 
      10-17-2003
Christopher Benson-Manica <(E-Mail Removed)> wrote:

>Irrwahn Grausewitz <(E-Mail Removed)> spoke thus:
>
>> Nope, according to ISO/IEC 9899:1999 5.1.2.2.3 and 7.20.4.3#5
>> it is perfectly portable.

>
><dumb>So if 0 is portable, why the EXIT_SUCCESS macro?</dumb>


Because it's more descriptive and has a portable(!) and descriptive
counter-part, EXIT_FAILURE.

ISO/IEC 9899:1999 7.20.4.3
5 [...] If the value of status is zero or EXIT_SUCCESS, an
implementation-defined form of the status successful termination is
returned. If the value of status is EXIT_FAILURE, an implementation-
defined form of the status unsuccessful termination is returned.
Otherwise the status returned is implementation-defined.

Regards
--
Irrwahn
((E-Mail Removed))
 
Reply With Quote
 
 
 
 
Christopher Benson-Manica
Guest
Posts: n/a
 
      10-17-2003
Irrwahn Grausewitz <(E-Mail Removed)> spoke thus:

> Because it's more descriptive and has a portable(!) and descriptive
> counter-part, EXIT_FAILURE.


So it's kind of like the unary + thing, symmetry and all? I dunno, I always
thought the l337-ness of C code was directly related to how obfuscated it
looked

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
 
Reply With Quote
 
Irrwahn Grausewitz
Guest
Posts: n/a
 
      10-17-2003
Christopher Benson-Manica <(E-Mail Removed)> wrote:

>Irrwahn Grausewitz <(E-Mail Removed)> spoke thus:
>
>> Because it's more descriptive and has a portable(!) and descriptive
>> counter-part, EXIT_FAILURE.

>
>So it's kind of like the unary + thing, symmetry and all?


Hm, well, yes and no. I can remember a discussion about this in c.l.c
or c.s.c, where the claim was made that in the context of program exit
codes 0 may describe a kind of successful termination different from
what EXIT_SUCCESS results in. Whatever that means, practically.

>I dunno, I always
>thought the l337-ness of C code was directly related to how obfuscated it
>looked




Regards
--
Irrwahn
((E-Mail Removed))
 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      10-17-2003
In <bmoppn$p55$(E-Mail Removed)> Christopher Benson-Manica <(E-Mail Removed)> writes:

>Irrwahn Grausewitz <(E-Mail Removed)> spoke thus:
>
>> Because it's more descriptive and has a portable(!) and descriptive
>> counter-part, EXIT_FAILURE.

>
>So it's kind of like the unary + thing, symmetry and all?


Exactly.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      10-17-2003
In <(E-Mail Removed)> Irrwahn Grausewitz <(E-Mail Removed)> writes:

>Christopher Benson-Manica <(E-Mail Removed)> wrote:
>
>>Irrwahn Grausewitz <(E-Mail Removed)> spoke thus:
>>
>>> Because it's more descriptive and has a portable(!) and descriptive
>>> counter-part, EXIT_FAILURE.

>>
>>So it's kind of like the unary + thing, symmetry and all?

>
>Hm, well, yes and no. I can remember a discussion about this in c.l.c
>or c.s.c, where the claim was made that in the context of program exit
>codes 0 may describe a kind of successful termination different from
>what EXIT_SUCCESS results in. Whatever that means, practically.


Nothing at all, in the context of portable programming. Furthermore, the
most natural interpretation of the standard is that both are mapped to
the *same* form of successful termination.

5 Finally, control is returned to the host environment. If the
value of status is zero or EXIT_SUCCESS, an implementation-defined
^^
form of the status successful termination is returned.

The standard talks about a *single* "implementation-defined form of
the status successful termination".

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: (E-Mail Removed)
 
Reply With Quote
 
Irrwahn Grausewitz
Guest
Posts: n/a
 
      10-17-2003
(E-Mail Removed) (Dan Pop) wrote:

>In <(E-Mail Removed)> Irrwahn Grausewitz <(E-Mail Removed)> writes:


<snip>
>>Hm, well, yes and no. I can remember a discussion about this in c.l.c
>>or c.s.c, where the claim was made that in the context of program exit
>>codes 0 may describe a kind of successful termination different from
>>what EXIT_SUCCESS results in. Whatever that means, practically.

>
>Nothing at all, in the context of portable programming. Furthermore, the
>most natural interpretation of the standard is that both are mapped to
>the *same* form of successful termination.
>
>5 Finally, control is returned to the host environment. If the
> value of status is zero or EXIT_SUCCESS, an implementation-defined
> ^^
> form of the status successful termination is returned.
>
>The standard talks about a *single* "implementation-defined form of
>the status successful termination".


It's the most natural interpretation, I agree. I just remembered the
discussion, not the outcome...

--
Irrwahn
((E-Mail Removed))
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scanf double amarapreet C Programming 3 08-08-2008 12:17 AM
difference between scanf("%i") and scanf("%d") ??? perhaps bug inVS2005? =?ISO-8859-1?Q?Martin_J=F8rgensen?= C Programming 18 05-02-2006 10:53 AM
scanf (yes/no) - doesn't work + deprecation errors scanf, fopen etc. =?ISO-8859-1?Q?Martin_J=F8rgensen?= C Programming 185 04-03-2006 02:49 PM
scanf to handle double Red Dragon C Programming 10 11-03-2005 10:15 AM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM



Advertisments