Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Line input and implementation-defined behaviour

Reply
Thread Tools

Line input and implementation-defined behaviour

 
 
Martin Stromberg
Guest
Posts: n/a
 
      10-01-2003
Dan Pop () wrote:
: The C89 text is perfectly clear:

: ... if the value cannot be represented the result is
: implementation-defined.

: So, it is only *the result* that is implementation-defined, not any other
: aspect of the program's behaviour.

So "the result" can't be the programs behaviour but must be the return
value?

Vague.


Right,

MartinS
 
Reply With Quote
 
 
 
 
Dan Pop
Guest
Posts: n/a
 
      10-01-2003
In <blei40$7u2$> (Martin Stromberg) writes:

>Dan Pop () wrote:
>: The C89 text is perfectly clear:
>
>: ... if the value cannot be represented the result is
>: implementation-defined.
>
>: So, it is only *the result* that is implementation-defined, not any other
>: aspect of the program's behaviour.
>
>So "the result" can't be the programs behaviour but must be the return
>value?
>
>Vague.


Not vague at all, if read in context. There is no "return value" at all
involved, BTW.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email:
 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Johan_Aur=E9r?=
Guest
Posts: n/a
 
      10-01-2003
On Wed, 1 Oct 2003, Martin Stromberg wrote:

> Dan Pop () wrote:
> : The C89 text is perfectly clear:
>
> : ... if the value cannot be represented the result is
> : implementation-defined.
>
> : So, it is only *the result* that is implementation-defined, not any other
> : aspect of the program's behaviour.
>
> So "the result" can't be the programs behaviour but must be the return
> value?


It must be a value, yes.

> Vague.


Perhaps, but trying to make sense of isolated sentences from the standard
will seldom get you anywhere. 6.2p.1 says

"Several operators convert operand values from one type to another
^^^^^^^ ^^^^^^
automatically. This subclause specifies the result from such an
^^^^^^
implicit conversion, ..."
^^^^^^^^^^

Since a conversion is defined as an operation that yields a *value*, the
*result* of a conversion must be a value.

--

 
Reply With Quote
 
Niklas Matthies
Guest
Posts: n/a
 
      10-01-2003
On 2003-10-01 14:36, Johan Aurér <> wrote:
> On Wed, 1 Oct 2003, Martin Stromberg wrote:

[...]
>> So "the result" can't be the programs behaviour but must be the return
>> value?

>
> It must be a value, yes.
>
>> Vague.

>
> Perhaps, but trying to make sense of isolated sentences from the standard
> will seldom get you anywhere. 6.2p.1 says
>
> "Several operators convert operand values from one type to another
> ^^^^^^^ ^^^^^^
> automatically. This subclause specifies the result from such an
> ^^^^^^
> implicit conversion, ..."
> ^^^^^^^^^^
>
> Since a conversion is defined as an operation that yields a *value*, the
> *result* of a conversion must be a value.


....or a trap representation?

-- Niklas Matthies
 
Reply With Quote
 
lawrence.jones@eds.com
Guest
Posts: n/a
 
      10-01-2003
I wrote:
>
> In C89, it wasn't entirely clear whether
> "implementation-defined behavior" allowed that or not


In comp.std.c Al Grant <> wrote:
>
> It was entirely clear that it did.


In comp.std.c Dan Pop <> wrote:
>
> The C89 text is perfectly clear:

[...]
> So, it is only *the result* that is implementation-defined, not any other
> aspect of the program's behaviour.


Thank you for proving my point, gentlemen.

-Larry Jones

Yep, we'd probably be dead by now if it wasn't for Twinkies. -- Calvin
 
Reply With Quote
 
lawrence.jones@eds.com
Guest
Posts: n/a
 
      10-01-2003
In comp.std.c Kevin Easton <kevin@-nospam-pcug.org.au> wrote:
>
> It's a pity it wasn't disabled by default, with the program
> having to do something explicit to enable signal on overflow.


That's up to the implementation. I know of implementations that allow
integer overflow to be detected, but I don't know of any that do so by
default.

-Larry Jones

In my opinion, we don't devote nearly enough scientific research
to finding a cure for jerks. -- Calvin
 
Reply With Quote
 
Martin Stromberg
Guest
Posts: n/a
 
      10-02-2003
Dan Pop () wrote:
: In <blei40$7u2$> (Martin Stromberg) writes:
: >So "the result" can't be the programs behaviour but must be the return
: >value?
: >
: >Vague.

: Not vague at all, if read in context. There is no "return value" at all
: involved, BTW.

Errhm... For some reason I thought we were talking about strtol() or
similar. Now looking at the whole thread again, I see we wasn't.

Sorry.


Right,

MartinS
 
Reply With Quote
 
Al Grant
Guest
Posts: n/a
 
      10-02-2003
wrote in message news:<aqnr41->...
> I wrote:
> >
> > In C89, it wasn't entirely clear whether
> > "implementation-defined behavior" allowed that or not

>
> In comp.std.c Al Grant <> wrote:
> >
> > It was entirely clear that it did.

>
> In comp.std.c Dan Pop <> wrote:
> >
> > The C89 text is perfectly clear:

> [...]
> > So, it is only *the result* that is implementation-defined, not any other
> > aspect of the program's behaviour.

>
> Thank you for proving my point, gentlemen.


You have ignored the rest of my post:

It was also entirely clear that 3.2.1.2 did not use the phrase
"implementation-defined behavior". What it said was "if the
value cannot be represented the result is implementation-defined".

As far as I can tell Dan Pop and I have both read the standard
in the same way. You appear not to have read it at all in that
you are asking about the interpretation of a phrase that doesn't
even occur in the part of the standard under discussion.
 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      10-02-2003
In <> Niklas Matthies <> writes:

>On 2003-10-01 14:36, Johan Aurér <> wrote:
>> On Wed, 1 Oct 2003, Martin Stromberg wrote:

>[...]
>>> So "the result" can't be the programs behaviour but must be the return
>>> value?

>>
>> It must be a value, yes.
>>
>>> Vague.

>>
>> Perhaps, but trying to make sense of isolated sentences from the standard
>> will seldom get you anywhere. 6.2p.1 says
>>
>> "Several operators convert operand values from one type to another
>> ^^^^^^^ ^^^^^^
>> automatically. This subclause specifies the result from such an
>> ^^^^^^
>> implicit conversion, ..."
>> ^^^^^^^^^^
>>
>> Since a conversion is defined as an operation that yields a *value*, the
>> *result* of a conversion must be a value.

>
>...or a trap representation?


No such thing in C89, the standard we're talking about.

And I doubt that even in C99, a trap representation is a valid option when
the standard specifies an implementation-defined value.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email:
 
Reply With Quote
 
Kevin Easton
Guest
Posts: n/a
 
      10-02-2003
In comp.lang.c wrote:
> In comp.std.c Kevin Easton <kevin@-nospam-pcug.org.au> wrote:
>>
>> It's a pity it wasn't disabled by default, with the program
>> having to do something explicit to enable signal on overflow.

>
> That's up to the implementation. I know of implementations that allow
> integer overflow to be detected, but I don't know of any that do so by
> default.


So there wouldn't have been any impediment to making that the mandated
behaviour then...

- Kevin.

 
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
Line in connector input not working? disabled? input radio to computer. 8ball meme Computer Support 7 11-18-2010 10:39 PM
Read a file line by line and write each line to a file based on the5th byte scad C++ 23 05-17-2009 06:11 PM
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
How to read a text file line by line and remove some line kaushikshome C++ 4 09-10-2006 10:12 PM
Read a file line by line with a maximum number of characters per line Hugo Java 10 10-18-2004 11:42 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57