Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Is it possible sentence?

Reply
Thread Tools

Is it possible sentence?

 
 
Dan Pop
Guest
Posts: n/a
 
      06-23-2004
In <(E-Mail Removed)> Jack Klein <(E-Mail Removed)> writes:

>On 22 Jun 2004 13:25:48 GMT, http://www.velocityreviews.com/forums/(E-Mail Removed) (Dan Pop) wrote in
>comp.lang.c:
>
>> In <(E-Mail Removed) > (E-Mail Removed) (Alex) writes:
>>
>> >I have a question regarding to string variable.
>> >
>> >Please look at below example.
>> >------------------------------
>> >#define STR "ABC"
>> >
>> >char *testStr;
>> >testStr = STR;
>> >------------------------------
>> >
>> >I think above example have no problem.

>>
>> Indeed, it is correct (after fixing an obvious typo).
>>
>> >But I don't know where "ABC" is exist.

>>
>> It is typically stored in either the data segment or the text segment

> ^^^^^^^^^
>Who says C programs have data segments and text segments?


No one. Do you have the slightest clue about the meaning of the word
"typically"? In context, it means: "it is common practice to". If you
have any sensible objection to my statement above, please make it. But
keep the crap for yourself.

>Chapter and verse.


From what?

>> of the program. If you can change it at runtime without crashing the
>> program, then it's probably in the data segment. If the program crashes,
>> it's in the text segment. Let's see:

>
>Let's not. A strictly conforming program can't tell what happens when
>a string literal is changed, since it ceases to be strictly conforming
>when it tries to perform the change.


Therefore, I used a non-strictly conforming program to make my point.

>In most of the environments where the code I get paid to write
>executes, the undefined behavior of attempting to modify a string
>literal is ... nothing at all.


In most of the environments you're talking about, calling printf (without
defining it) invokes undefined behaviour. So, should I avoid using
printf because of that?

Feel free to flame me when I start talking about segmentation faults or
the ability to alter string literals in comp.arch.embedded. But make the
effort to remember that the implementations we're talking about in c.l.c
are, by default, hosted.

Dan

P.S. And your point was... ?

--
Dan Pop
DESY Zeuthen, RZ group
Email: (E-Mail Removed)
 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      06-25-2004
On 23 Jun 2004 15:27:24 GMT, (E-Mail Removed) (Dan Pop) wrote in
comp.lang.c:

> In <(E-Mail Removed)> Jack Klein <(E-Mail Removed)> writes:
>
> >On 22 Jun 2004 13:25:48 GMT, (E-Mail Removed) (Dan Pop) wrote in
> >comp.lang.c:

>
> >Let's not. A strictly conforming program can't tell what happens when
> >a string literal is changed, since it ceases to be strictly conforming
> >when it tries to perform the change.

>
> Therefore, I used a non-strictly conforming program to make my point.
>
> >In most of the environments where the code I get paid to write
> >executes, the undefined behavior of attempting to modify a string
> >literal is ... nothing at all.

>
> In most of the environments you're talking about, calling printf (without
> defining it) invokes undefined behaviour. So, should I avoid using
> printf because of that?
>
> Feel free to flame me when I start talking about segmentation faults or
> the ability to alter string literals in comp.arch.embedded. But make the
> effort to remember that the implementations we're talking about in c.l.c
> are, by default, hosted.
>
> Dan
>
> P.S. And your point was... ?


What part of:

> Let's not. A strictly conforming program can't tell what happens when
> a string literal is changed, since it ceases to be strictly conforming
> when it tries to perform the change.


....didn't you understand?

Describing what happens once a program invokes undefined behavior is
not a C language issue and is quite off-topic here.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
Reply With Quote
 
 
 
 
Minti
Guest
Posts: n/a
 
      06-25-2004
Jack Klein <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
> On 23 Jun 2004 15:27:24 GMT, (E-Mail Removed) (Dan Pop) wrote in
> comp.lang.c:
>
> > In <(E-Mail Removed)> Jack Klein <(E-Mail Removed)> writes:
> >
> > >On 22 Jun 2004 13:25:48 GMT, (E-Mail Removed) (Dan Pop) wrote in
> > >comp.lang.c:

>
> > >Let's not. A strictly conforming program can't tell what happens when
> > >a string literal is changed, since it ceases to be strictly conforming
> > >when it tries to perform the change.

> >
> > Therefore, I used a non-strictly conforming program to make my point.
> >
> > >In most of the environments where the code I get paid to write
> > >executes, the undefined behavior of attempting to modify a string
> > >literal is ... nothing at all.

> >
> > In most of the environments you're talking about, calling printf (without
> > defining it) invokes undefined behaviour. So, should I avoid using
> > printf because of that?
> >
> > Feel free to flame me when I start talking about segmentation faults or
> > the ability to alter string literals in comp.arch.embedded. But make the
> > effort to remember that the implementations we're talking about in c.l.c
> > are, by default, hosted.
> >
> > Dan
> >
> > P.S. And your point was... ?

>
> What part of:
>
> > Let's not. A strictly conforming program can't tell what happens when
> > a string literal is changed, since it ceases to be strictly conforming
> > when it tries to perform the change.

>
> ...didn't you understand?
>
> Describing what happens once a program invokes undefined behavior is
> not a C language issue and is quite off-topic here.



So that means that saying that :

"I coded it and @Nasal Daemons@ started flowing out my nose(?)" would
be much better than saying that it might cause Segmentation fault. IMO
opinion when a newbie asks a question it is much better to give a real
perspective as to what *might* happen, rather than using terminology
for which he might spend next half an hour searching the net, and
which _might_ *never* happen.

--
Imanpreet Singh Arora
isingh AT acm DOT org
 
Reply With Quote
 
Dan Pop
Guest
Posts: n/a
 
      06-25-2004
In <(E-Mail Removed)> Jack Klein <(E-Mail Removed)> writes:

>> Let's not. A strictly conforming program can't tell what happens when
>> a string literal is changed, since it ceases to be strictly conforming
>> when it tries to perform the change.

>
>...didn't you understand?


What part of my previous text reflected my failure to understand this
irrelevant remark?

>Describing what happens once a program invokes undefined behavior is
>not a C language issue and is quite off-topic here.


You're confusing c.l.c and comp.std.c. If you can't tolerate discussions
that go beyond the chapter and verse of the standard, c.l.c is not for
you.

The purpose (or one of the main purposes) of c.l.c is to help people
learn C and practical issues are *as* important as the theoretical ones.
People make programming mistakes and invoke undefined behaviour, as a
result. Understanding the *practical* consequences of invoking undefined
behaviour helps finding mistakes that led to invoking undefined behaviour.

We also recommend people to carefully read and try to understand the
diagnostics generated by their compilers, although there is no chapter
and verse in the standard supporting such a recommendation. Are you
strongly objecting to this recommendation, too? How about the one
about not casting the return value of malloc? There is no chapter and
verse forbidding it, right?

You're kindly invited to remove your head from your arse. The brain
can greatly benefit from the additional oxygen...

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: (E-Mail Removed)
 
Reply With Quote
 
Tak-Shing Chan
Guest
Posts: n/a
 
      06-25-2004
On Thu, 24 Jun 2004, Jack Klein wrote:

> Describing what happens once a program invokes undefined behavior is
> not a C language issue and is quite off-topic here.


Google groups search: +"Jack Klein" +"DeathStation" and I
found this:

``On the DeathStation 9000 it might mean launch nuclear
missiles at Antarctica'' -- Jack Klein, 2002-06-22

Tak-Shing

 
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
efficient data loading with Python, is that possible possible? igor.tatarinov@gmail.com Python 10 12-14-2007 04:44 PM
is it possible to possible to create an iterator from a callback interace? aninnymouse@gmail.com C Programming 4 02-21-2006 02:10 PM
XML + XSD: Is it possible to get all possible Values for an Element? Markus Java 1 11-22-2005 02:51 PM
Possible to connect 2 computers via USB? Michael Giroux Wireless Networking 2 09-02-2004 03:27 AM
Possible domain related wireless problem =?Utf-8?B?QWxpIEQ=?= Wireless Networking 0 08-10-2004 01:59 AM



Advertisments