PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > Re: pointer offsetting
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: pointer offsetting

Réponse
 
LinkBack Outils de la discussion
Vieux 17/10/2007, 03h15   #1
Barry Schwarz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pointer offsetting

On Sun, 14 Oct 2007 12:44:02 +0000 (UTC), $)CHarald van D)&k
<truedfx@gmail.com> wrote:

>On Sat, 13 Oct 2007 18:48:38 -0700, Barry Schwarz wrote:
>> On Thu, 11 Oct 2007 19:39:30 +0000 (UTC), roberson@ibd.nrc-cnrc.gc.ca
>> (Walter Roberson) wrote:
>>
>>>In article <1192130548.100801.171110@o3g2000hsb.googlegroups. com>,
>>> <c.a.l@seznam.cz> wrote:
>>>>a) If i do
>>>>pointer = pointer_to_safe_thing - 1000; pointer[1000] ==
>>>>pointer_to_safe_thing[0];
>>>
>>>>then
>>>>I am *not* accessing invalid memory. Nor i am incorrect in mathematical
>>>>sense.
>>>>Nevertheless outcome of pointer_to_safe_memory - 1000 operation
>>>>yielding pointer may be undefined. For i do not know whether pointers
>>>>wraparound like integers?
>>>
>>>Implementation dependant. You can only *safely* have a pointer that is
>>>NULL, or points into an object, or points "one past" the end of the
>>>object.

>>
>> Nope. It is undefined behavior

>
>Undefined behaviour is inherently implementation dependent.
>

Implementation dependent implies that the behavior will be consistent
on a particular implementation (the same today as it was yesterday).
Undefined behavior is not so constrained.


Remove del for email
  Réponse avec citation
Vieux 17/10/2007, 14h35   #2
James Kuyper Jr.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pointer offsetting

Barry Schwarz wrote:
> On Sun, 14 Oct 2007 12:44:02 +0000 (UTC), $)CHarald van D)&k
> <truedfx@gmail.com> wrote:

....
>> Undefined behaviour is inherently implementation dependent.
>>

> Implementation dependent implies that the behavior will be consistent
> on a particular implementation (the same today as it was yesterday).


Citation, please?

"Implementation-dependent behavior" isn't a term defined in the C
standard. It's normal English meaning is only that the behavior depends
upon which implementation you use, which is certainly true for undefined
behavior. I don't see any implication that the behavior has to be
consistent.
  Réponse avec citation
Vieux 19/10/2007, 18h27   #3
Barry Schwarz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pointer offsetting

On Wed, 17 Oct 2007 13:35:44 GMT, "James Kuyper Jr."
<jameskuyper@verizon.net> wrote:

>Barry Schwarz wrote:
>> On Sun, 14 Oct 2007 12:44:02 +0000 (UTC), $)CHarald van D)&k
>> <truedfx@gmail.com> wrote:

>...
>>> Undefined behaviour is inherently implementation dependent.
>>>

>> Implementation dependent implies that the behavior will be consistent
>> on a particular implementation (the same today as it was yesterday).

>
>Citation, please?
>
>"Implementation-dependent behavior" isn't a term defined in the C
>standard. It's normal English meaning is only that the behavior depends
>upon which implementation you use, which is certainly true for undefined
>behavior. I don't see any implication that the behavior has to be
>consistent.


If the behavior is implementation-dependent (I agree with your normal
meaning), and if the implementation doesn't changed, it is reasonable
to conclude that the behavior won't either. If it does, then it
depends on something other (or something more) than the
implementation. Undefined behavior offers no such assurances.


Remove del for email
  Réponse avec citation
Vieux 19/10/2007, 18h40   #4
jameskuyper@verizon.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pointer offsetting

Barry Schwarz wrote:
> On Wed, 17 Oct 2007 13:35:44 GMT, "James Kuyper Jr."
> <jameskuyper@verizon.net> wrote:
>
> >Barry Schwarz wrote:
> >> On Sun, 14 Oct 2007 12:44:02 +0000 (UTC), $)CHarald van D )& k
> >> <truedfx@gmail.com> wrote:

> >...
> >>> Undefined behaviour is inherently implementation dependent.
> >>>
> >> Implementation dependent implies that the behavior will be consistent
> >> on a particular implementation (the same today as it was yesterday).

> >
> >Citation, please?
> >
> >"Implementation-dependent behavior" isn't a term defined in the C
> >standard. It's normal English meaning is only that the behavior depends
> >upon which implementation you use, which is certainly true for undefined
> >behavior. I don't see any implication that the behavior has to be
> >consistent.

>
> If the behavior is implementation-dependent (I agree with your normal
> meaning), and if the implementation doesn't changed, it is reasonable
> to conclude that the behavior won't either. If it does, then it
> depends on something other (or something more) than the
> implementation. Undefined behavior offers no such assurances.


To say that something depends upon one thing is not the same as saying
that it depends only upon that thing.

If, with implementation A, the behavior depends upon the day of the
week, and with implementation B the behavior depends upon whether or
not the current month has an 'r' in it, then the behavior is
implementation dependent, even though knowing which implementation
you're using is not sufficient to determine what the behavior actually
is. The behavior is also, in both cases, time dependent, which does
not conflict with the fact that it is also implementation-dependent.

  Réponse avec citation
Vieux 19/10/2007, 19h35   #5
Eric Sosman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pointer offsetting

Barry Schwarz wrote On 10/19/07 13:27,:
> On Wed, 17 Oct 2007 13:35:44 GMT, "James Kuyper Jr."
> <jameskuyper@verizon.net> wrote:
>
>
>>Barry Schwarz wrote:
>>
>>>On Sun, 14 Oct 2007 12:44:02 +0000 (UTC), $)CHarald van D)&k
>>><truedfx@gmail.com> wrote:

>>
>>...
>>
>>>>Undefined behaviour is inherently implementation dependent.
>>>>
>>>
>>>Implementation dependent implies that the behavior will be consistent
>>>on a particular implementation (the same today as it was yesterday).

>>
>>Citation, please?
>>
>>"Implementation-dependent behavior" isn't a term defined in the C
>>standard. It's normal English meaning is only that the behavior depends
>>upon which implementation you use, which is certainly true for undefined
>>behavior. I don't see any implication that the behavior has to be
>>consistent.

>
>
> If the behavior is implementation-dependent (I agree with your normal
> meaning), and if the implementation doesn't changed, it is reasonable
> to conclude that the behavior won't either. If it does, then it
> depends on something other (or something more) than the
> implementation. Undefined behavior offers no such assurances.


Where is it written that "the implementation" can
have no time-varying components? The behavior of

puts( __TIME__ );

.... clearly changes as the module is compiled and recompiled,
and although __TIME__ itself is not implementation-defined
its value certainly is. Can't the rest of the implementation
have at least this much freedom?

--
Eric.Sosman@sun.com
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h41.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11627 seconds with 13 queries