473,386 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

level of questions for experts only

hello,
response if u ,on all level of questions:::
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
3.why :: printf("%%%%%") ; output %%%.
4.how 2 run a .obj file without previously creating any .exe?
5.what is classical class?(FOR C++)

bye,
Nov 13 '05 #1
53 3932
ROSY wrote:
response if u ,on all level of questions:::
This means what, in English?
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
3.why :: printf("%%%%%") ; output %%%.
4.how 2 run a .obj file without previously creating any .exe?
5.what is classical class?(FOR C++)


Wow, not only for experts, but mostly for experts in other
newsgroups ;)

1, 2: Platform-specific; ask on a group for your platform.
4: Also platform-specific, but it sounds like you want to run
something that hasn't been linked, which I suspect can't be done.
5: You seem to be aware that this is a C++ question. Are you aware
that you asked it in comp.lang.c? We don't do C++ here.

3: '%' in the first argument to printf() starts a format specifier.
"%%" is the format specifier that means "print '%'". Apparently the
last one, being by itself at the end, also prints '%'; I don't know
if that's standard or just what your implementation does.

--
Tom Zych
This is a fake email address to thwart spammers.
Real address: echo 'g******@cbobk.pbz' | rot13
Nov 13 '05 #2
"ROSY" <de**************@rediffmail.com> wrote in message
news:73**************************@posting.google.c om...
hello,
response if u ,on all level of questions:::
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
Not a question about C.
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?
Yes.
if yes,which?
Decide what you want each pattern to mean, and parse
accordingly.
3.why :: printf("%%%%%") ; output %%%.
Look up 'escape sequence' in a C book.
4.how 2 run a .obj file without previously creating any .exe?
Not a question about C.
5.what is classical class?(FOR C++)
Not a question about C. Nor does C++ have anything
called a 'classical class'.

bye,


Here's a question for you: Where's your textbook?

-Mike
Nov 13 '05 #3

"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:7Q*****************@newsread3.news.pas.earthl ink.net...
3.why :: printf("%%%%%") ; output %%%.


Look up 'escape sequence' in a C book.


Sorry, not 'escape sequence', but 'format specifiers'
for 'printf()' function.

-Mike
Nov 13 '05 #4
Tom Zych <tz******@pobox.com> wrote:
ROSY wrote:

<SNIP>
3.why :: printf("%%%%%") ; output %%%.


3: '%' in the first argument to printf() starts a format specifier.
"%%" is the format specifier that means "print '%'". Apparently the
last one, being by itself at the end, also prints '%'; I don't know
if that's standard or just what your implementation does.


IMO printf("%"); invokes undefined behaviour because it
consits of an invalid conversion specification, according
to ISO/IEC 9899:1999 7.19.6.1#9.

Regards

Irrwahn
--
ERROR 103: Dead mouse in hard drive.
Nov 13 '05 #5
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
hello,
response if u ,on all level of questions:::
idiot!!!
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
3.why :: printf("%%%%%") ; output %%%.
4.how 2 run a .obj file without previously creating any .exe?
5.what is classical class?(FOR C++)


by now you should have realised that no one in this
group will do your homework for you. trying to engage
them with "expert" questions only further enrages the
regulars.

goose,
did you even read the faq for clc yet ?
Nov 13 '05 #6
goose <ru**@webmail.co.za> scribbled the following:
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
hello,
response if u ,on all level of questions:::
idiot!!!


Seconded. You (ROSY) should also invest in a readable writing style and
not h4x0r d00d l33tsp33k like this.
I'll rewrite your questions like they would have been posed by a sane
person.

Hello, respond if you are on all level of questions.
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
How can a self-deletable .exe file delete itself on some future date
and time without invoking the .exe file itself?
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
If we want any wildcard characters in command line arguments to be
appropriately expanded, are we required to make any special provision?
If yes, which?
3.why :: printf("%%%%%") ; output %%%.
Why printf("%%%%%"); outputs %%%?
4.how 2 run a .obj file without previously creating any .exe?
How to run a .obj file without previously creating any .exe file?
5.what is classical class?(FOR C++)


What is a classical class? (For C++)

Most important rules:
1) It's "you". Y-O-U. "U" is not a pronoun, it's a letter. Furthermore,
"ur" is a German prefix. In English we write "your" or "you're". No
points deducted for confusing the two, native speakers also often do.
2) Numbers are numbers, words are words, and never the twain shall
meet. "Words" like "2" for "to" and "4" for "four" belong to 12-year-
old script kiddies.
3) Use proper capitalisation. The first letter of the first word of
a sentence should be capitalised. In other words, do not write like
e.e.cummings.
4) Question sentences should end in a question mark. ONE question
mark. Not like "can U help me plz?????????????????????????????????????".
Yes, you guessed it, "plz" is also out. Write "please". And on the off
chance you should ever receive a real answer (which would require a
real question in the first place), say "thanks", not "thx".

That should cover the most of the lot.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"Shh! The maestro is decomposing!"
- Gary Larson
Nov 13 '05 #7
Joona I Palaste <pa*****@cc.helsinki.fi> scribbled the following:
2) Numbers are numbers, words are words, and never the twain shall
meet. "Words" like "2" for "to" and "4" for "four" belong to 12-year-
old script kiddies.


That should be "4" for "for", natch.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"You will be given the plague."
- Montgomery Burns
Nov 13 '05 #8
In <7Q*****************@newsread3.news.pas.earthlink. net> "Mike Wahler" <mk******@mkwahler.net> writes:
"ROSY" <de**************@rediffmail.com> wrote in message
news:73**************************@posting.google. com...
3.why :: printf("%%%%%") ; output %%%.


Look up 'escape sequence' in a C book.


Huh?!? Can't see any escape sequence in this format string. And the
effect of the 5th '%' sign can't be explained by any C book, being
undefined.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #9
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
hello,
response if u ,on all level of questions:::
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
This is not a question about the C programming language.

Let me get this straight. You have an executable that deletes itself.
You want this executable to delete itself at some future time, but
without invoking the executable?

If you don't actually run the program, how can it be expected to
delete itself?
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
If the shell from which you invoked the program does not expand
wildcards for you, you will have to expand those wildcards manually.
How you do so depends on what utilities are available to you. There's
no facility in the standard library that I'm aware of that will do
this for you. Otherwise, I'm not sure what you mean by special
provision.
3.why :: printf("%%%%%") ; output %%%.
This should be answered in your handy C reference manual (H&S4, p378;
K&R2, p244).

I will remind you again that this newsgroup is not meant to be a
substitute for a good reference manual.
4.how 2 run a .obj file without previously creating any .exe?
This is not a question about C, but about how your particular
compiler/linker/platform combination produce executable code.

FWIW, on most platforms I'm familiar with, you can't run the .obj file
directly.
5.what is classical class?(FOR C++)
This question should be answered by your handy C++ reference manual.

bye,

Nov 13 '05 #10

"Dan Pop" <Da*****@cern.ch> wrote in message
news:bl**********@sunnews.cern.ch...
In <7Q*****************@newsread3.news.pas.earthlink. net> "Mike Wahler" <mk******@mkwahler.net> writes:
"ROSY" <de**************@rediffmail.com> wrote in message
news:73**************************@posting.google. com...
3.why :: printf("%%%%%") ; output %%%.
Look up 'escape sequence' in a C book.


Huh?!? Can't see any escape sequence in this format string.


See my self correction this thread.
And the
effect of the 5th '%' sign can't be explained by any C book, being
undefined.


Good eye! I didn't notice there was odd number of '%'

-Mike

Nov 13 '05 #11
Irrwahn Grausewitz <ir*****************@freenet.de> spoke thus:
IMO printf("%"); invokes undefined behaviour because it
consits of an invalid conversion specification, according
to ISO/IEC 9899:1999 7.19.6.1#9.


Why is the compiler allowed to compile this? In other words, why mustn't it
interpret the %" as a conversion specifier and consequently inform you about
an unterminated string constant?

(FWIW, gcc warns about "spurious trailing '%' in format.")

--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cyberspace.org |
Nov 13 '05 #12
On Fri, 26 Sep 2003 16:09:05 +0000 (UTC), Christopher Benson-Manica
<at***@nospam.cyberspace.org> wrote in comp.lang.c:
Irrwahn Grausewitz <ir*****************@freenet.de> spoke thus:
IMO printf("%"); invokes undefined behaviour because it
consits of an invalid conversion specification, according
to ISO/IEC 9899:1999 7.19.6.1#9.


Why is the compiler allowed to compile this? In other words, why mustn't it
interpret the %" as a conversion specifier and consequently inform you about
an unterminated string constant?

(FWIW, gcc warns about "spurious trailing '%' in format.")


There is no unterminated string constant. String literals are
converted to unnamed arrays of char by the compiler, which cares
nothing at all for the '%' character. The only character that matters
to the compiler in a string literal is '\'.

Some compilers have options to check the format string against the
arguments at compile time, but this is not required by the standard.
Passing a mis-match list of arguments to printf() at run time is just
plain undefined behavior, as Irrwahn quoted, and an implementation is
NEVER required to diagnose undefined behavior.

--
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++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #13
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
Irrwahn Grausewitz <ir*****************@freenet.de> spoke thus:
IMO printf("%"); invokes undefined behaviour because it
consits of an invalid conversion specification, according
to ISO/IEC 9899:1999 7.19.6.1#9.
Why is the compiler allowed to compile this? In other words, why mustn't it
interpret the %" as a conversion specifier and consequently inform you about
an unterminated string constant?


The standard doesn't require diagnostics in case of UB.
Once UB is invoked, the implementation is free to do whatever it likes.
You'd better not run the above code on a DS9000.
(FWIW, gcc warns about "spurious trailing '%' in format.")


That's nice of it, isn't it? :)

Irrwahn
--
ERROR 103: Dead mouse in hard drive.
Nov 13 '05 #14
Joona I Palaste wrote:
goose <ru**@webmail.co.za> scribbled the following:
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
hello,
response if u ,on all level of questions:::
idiot!!!
Seconded. You (ROSY) should also invest in a readable writing style and
not h4x0r d00d l33tsp33k like this.
I'll rewrite your questions like they would have been posed by a sane
person.

Hello, respond if you are on all level of questions.

That still doesn't make sense to me. Either I am missing something or
you didn't quite achieve what you said you would ("rewrite the questions
as would have been posed by a sane person").3.why :: printf("%%%%%") ; output %%%.

Why printf("%%%%%"); outputs %%%?

Ah, I don't think so. Maybe you should avoid treading on such slippery
slopes. When correcting someone's language (be it English or C), you
will agree that you have to be spotless (and this is actually why most
spelling and grammar newsgroups are such flame fields). That would at
the very least (not considering how to gracefully mix code and English) be:

Why does printf("%%%%%"); output %%%?
In English we write "your" or "you're". No
points deducted for confusing the two, native speakers also often do.
I will certainly not agree with that. The difference between "your" and
"you're", as between "its" and "it's" or between "they're" and "their"
is not all that subtle. Allowing some phonetic switching but forbidding
other (as you do below) is plain hypocrisy.
2) Numbers are numbers, words are words, and never the twain shall
meet. "Words" like "2" for "to" and "4" for "four" belong to 12-year-
old script kiddies.


--
Bertrand Mollinier Toublet
"Bikes are like ladies, if you don't take care of them all the time,
when you feel like going back to them, it takes a lot of work"
-- Riccardo Turchetto

Nov 13 '05 #15
Christopher Benson-Manica <at***@nospam.cyberspace.org> writes:
Irrwahn Grausewitz <ir*****************@freenet.de> spoke thus:
IMO printf("%"); invokes undefined behaviour because it
consits of an invalid conversion specification, according
to ISO/IEC 9899:1999 7.19.6.1#9.


Why is the compiler allowed to compile this? In other words, why mustn't it
interpret the %" as a conversion specifier and consequently inform you about
an unterminated string constant?

(FWIW, gcc warns about "spurious trailing '%' in format.")


The format string is interpreted at run time, not at compilation time.
For example:

char *s = some_func(); # happens to return "%"
printf(s);

Since there's no opportunity in the general case to check this during
compilation, the compiler isn't required to check it in the special
case of passing a string literal. It's good that gcc gives a warning,
but it's not required to.

--
Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 13 '05 #16
On 25 Sep 2003 20:15:22 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:
hello,
response if u ,on all level of questions:::
1.how a self deletable .exe file deleted on some future date & time
without invoking the .exe itself?
This is not a C question. Please ask it again in a group specialising
in your operating system as it is specific to that. You've already
been told this by the way.
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
Expanded to what? If you want to expand wildcards, write some code.
3.why :: printf("%%%%%") ; output %%%.
it doesnt, it prints %%. This is because each %% is converted to a %,
and the stray lonely % at the end is ignored.
4.how 2 run a .obj file without previously creating any .exe?
This is not a C question. Please ask it again in a group specialising
in your operating system but be aware that its not even a meaningful
question for most OSen. Its akin to saying "how can I use my computer
without previously connecting the parts together?"
5.what is classical class?(FOR C++)


This is not a C question. Please ask it again in a C++ group
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #17
Mark McIntyre <ma**********@spamcop.net> wrote:
On 25 Sep 2003 20:15:22 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:

<OT rubbish snipped>
3.why :: printf("%%%%%") ; output %%%.


it doesnt, it prints %%. This is because each %% is converted to a %,
and the stray lonely % at the end is ignored.


No. It invokes undefined behaviour. Your implementation may stop
translation, issue a diagnostic, print %%%, print %%, print "Strength is
irrelevant, resistance is futile!" and assimilate you, transfer all your
money to my bank account, nuke Labrador, or whatever.

<SNIP>

Irrwahn
--
ERROR 103: Dead mouse in hard drive.
Nov 13 '05 #18
"Jack Klein" <ja*******@spamcop.net> wrote in message
news:it********************************@4ax.com...

... an implementation is NEVER required to diagnose undefined behavior.


A constraint violation requires a diagnostic.

--
Peter
Nov 13 '05 #19
"Peter Nilsson" <ai***@acay.com.au> wrote in message
news:3f******@news.rivernet.com.au...
"Jack Klein" <ja*******@spamcop.net> wrote in message
news:it********************************@4ax.com...

... an implementation is NEVER required to diagnose undefined behavior.


A constraint violation requires a diagnostic.


Correct, but to which constraint violation do you refer?

Undefined behavior and constraint violations are not the
same thing (see 5.1.1.3 below), which specifically
distinguishes between them.

============

ISO/IEC 9899:1999 (E)

3. Terms, definitions, and symbols

[...]

3.4.3

1 undefined behavior

behavior, upon use of a nonportable or erroneous program
construct or of erroneous data, for which this International
Standard imposes no requirements

2 NOTE Possible undefined behavior ranges from ignoring the
situation completely with unpredictable results, to behaving
during translation or program execution in a documented manner
characteristic of the environment (with or without the issuance
of a diagnostic message), to terminating a translation or
execution (with the issuance of a diagnostic message).

3 EXAMPLE An example of undefined behavior is the behavior on
integer overflow.

[...]

3.8

1 constraint

restriction, either syntactic or semantic, by which the
exposition of language elements is to be interpreted

[...]

5.1.1.3 Diagnostics

1 A conforming implementation shall produce at least one diagnostic
message (identified in an implementation-defined manner) if a
preprocessing translation unit or translation unit contains a
violation of any syntax rule or constraint, even if the behavior
is also explicitly specified as undefined or implementation-defined.
Diagnostic messages need not be produced in other circumstances.(8)

2 EXAMPLE An implementation shall issue a diagnostic for the
translation unit:

char i;
int i;

because in those cases where wording in this International Standard
describes the behavior for a construct as being both a constraint
error and resulting in undefined behavior, the constraint error shall
be diagnosed.

[...]

(8) The intent is that an implementation should identify the nature
of, and where possible localize, each violation. Of course, an
implementation is free to produce any number of diagnostics as long
as a valid program is still correctly translated. It may also
successfully translate an invalid program.

============
-Mike

Nov 13 '05 #20
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:Xy*****************@newsread3.news.pas.earthl ink.net...
"Peter Nilsson" <ai***@acay.com.au> wrote in message
news:3f******@news.rivernet.com.au...
"Jack Klein" <ja*******@spamcop.net> wrote in message
news:it********************************@4ax.com...

... an implementation is NEVER required to diagnose undefined
behavior.
A constraint violation requires a diagnostic.
Correct, but to which constraint violation do you refer?


Take your pick.

<snip> 2 EXAMPLE An implementation shall issue a diagnostic for the
translation unit:

char i;
int i;

because in those cases where wording in this International Standard
describes the behavior for a construct as being both a constraint
error and resulting in undefined behavior, the constraint error shall
be diagnosed.


That will do nicely. :-)

Arguing that it is the constraint violation which is being diagnosed, not
the undefined behaviour, seems a rather moot point.

--
Peter
Nov 13 '05 #21
Keith Thompson <ks*@cts.com> spoke thus:
Since there's no opportunity in the general case to check this during
compilation, the compiler isn't required to check it in the special
case of passing a string literal. It's good that gcc gives a warning,
but it's not required to.


Oh I see. Thanks... (please excuse me while I feel stupid for a bit ;) )

--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cyberspace.org |
Nov 13 '05 #22

On Sat, 27 Sep 2003, Peter Nilsson wrote:

"Mike Wahler" <mk******@mkwahler.net> wrote...
"Peter Nilsson" <ai***@acay.com.au> wrote...
"Jack Klein" <ja*******@spamcop.net> wrote...
>
> ... an implementation is NEVER required to diagnose
> undefined behavior.

A constraint violation requires a diagnostic.


Correct, but to which constraint violation do you refer?


Take your pick.


Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation. So did you (Peter)
just randomly decide to explain under what conditions
diagnostics are required, just in case somebody didn't know?
or is there some method to your madness that none of us can
see -- e.g., there being a constraint violation in the line

printf("%%%%%");

?

-Arthur
Nov 13 '05 #23
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message
news:Pi**********************************@unix44.a ndrew.cmu.edu...
Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation. So did you (Peter)
just randomly decide to explain under what conditions
diagnostics are required, just in case somebody didn't know?
or is there some method to your madness that none of us can
see -- e.g., there being a constraint violation in the line

printf("%%%%%");

?


Arthur: Thanks for taking time to say that for me,
so I don't need to. :-)

-Mike
Nov 13 '05 #24
Christopher Benson-Manica <at***@nospam.cyberspace.org> writes:
Keith Thompson <ks*@cts.com> spoke thus:
Since there's no opportunity in the general case to check this during
compilation, the compiler isn't required to check it in the special
case of passing a string literal. It's good that gcc gives a warning,
but it's not required to.


Oh I see. Thanks... (please excuse me while I feel stupid for a bit ;) )


We all get used to it around here. 8-)}

--
Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 13 '05 #25
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bl**********@oravannahka.helsinki.fi>...

<snipped>
ooooh ... i just cannot resist :-)
I'll rewrite your questions like they would have been posed by a sane
person.

Hello, respond if you are on all level of questions.
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
How can a self-deletable .exe file delete itself on some future date
and time without invoking the .exe file itself?
thats an easy one. you hand the sysad for the machine a battle-axe,
and tell him when you want the .exe file deleted :-)
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
If we want any wildcard characters in command line arguments to be
appropriately expanded, are we required to make any special provision?
If yes, which?
3.why :: printf("%%%%%") ; output %%%.
Why printf("%%%%%"); outputs %%%?
because its a well-known fact that printf cannot count past three.
studies are currently being done in this field (by those who got
too bored with reality tv) to understand why printf cannot count past
three.
4.how 2 run a .obj file without previously creating any .exe?
How to run a .obj file without previously creating any .exe file?
an easy way to get anything/anyone to run is to place a large, fierce
yet slow *enough* dog behind them/it.
5.what is classical class?(FOR C++)


What is a classical class? (For C++)


thats the one that i flunked out in second-year
on campus. ROSY, dont worry too much about the
"C++" bit of the question. they just put that in
there to confuse you.

<snipped many important rules that i unfortunately break sometimes>

goose,
I've got the body of a 25-year old ... and its not
even against her will either :-)
Nov 13 '05 #26
On Sat, 27 Sep 2003 00:19:01 +0200, in comp.lang.c , Irrwahn
Grausewitz <ir*****************@freenet.de> wrote:
Mark McIntyre <ma**********@spamcop.net> wrote:
On 25 Sep 2003 20:15:22 -0700, in comp.lang.c ,
de**************@rediffmail.com (ROSY) wrote:
<OT rubbish snipped>
3.why :: printf("%%%%%") ; output %%%.


it doesnt, it prints %%. This is because each %% is converted to a %,
and the stray lonely % at the end is ignored.


No. It invokes undefined behaviour.


Indeed. I should have said so.
Your implementation may stop
translation, issue a diagnostic, print %%%, print %%, print "Strength is
irrelevant, resistance is futile!" and assimilate you, transfer all your
money to my bank account, nuke Labrador, or whatever.


All true. The most likely however is that it'll get ignored.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #27
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message
news:Pi**********************************@unix44.a ndrew.cmu.edu...
On Sat, 27 Sep 2003, Peter Nilsson wrote:
"Mike Wahler" <mk******@mkwahler.net> wrote...
"Peter Nilsson" <ai***@acay.com.au> wrote...
> "Jack Klein" <ja*******@spamcop.net> wrote...
> >
> > ... an implementation is NEVER required to diagnose
> > undefined behavior.
I see now that I should have prefixed my reply...

Although, this is not true in general.
> A constraint violation requires a diagnostic.

Correct, but to which constraint violation do you refer?
Take your pick.


Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation.


And mine was made with that context removed. I wasn't trying to misrepresent
Jack, I was merely focusing on a statement which drew my attention.
So did you (Peter)
just randomly decide to explain under what conditions
diagnostics are required, just in case somebody didn't know?


Lose the 'randomly' and you have it.

I decided to explain (rather poorly as it seems) that certain forms of
undefined behaviour do indeed *require* a diagnostic. [printf format
specifiers are not part of that list though.]

--
Peter
Nov 13 '05 #28
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:6i*****************@newsread3.news.pas.earthl ink.net...
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message
news:Pi**********************************@unix44.a ndrew.cmu.edu...

....
Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation. So did you (Peter)
just randomly decide to explain under what conditions
diagnostics are required, just in case somebody didn't know?
or is there some method to your madness that none of us can
see -- e.g., there being a constraint violation in the line

printf("%%%%%");

?


Arthur: Thanks for taking time to say that for me,
so I don't need to. :-)


Well, I guess I'm mad in thinking that certain forms of undefined behaviour
do indeed require diagnostics. So be it.

--
Peter
Nov 13 '05 #29

"Peter Nilsson" <ai***@acay.com.au> wrote in message
news:3f******@news.rivernet.com.au...
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:6i*****************@newsread3.news.pas.earthl ink.net...
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message
news:Pi**********************************@unix44.a ndrew.cmu.edu... ...
Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation. So did you (Peter)
just randomly decide to explain under what conditions
diagnostics are required, just in case somebody didn't know?
or is there some method to your madness that none of us can
see -- e.g., there being a constraint violation in the line

printf("%%%%%");

?


Arthur: Thanks for taking time to say that for me,
so I don't need to. :-)


Well, I guess I'm mad


I doubt mad, but perhaps misinformed or misunderstanding.
in thinking that certain forms of undefined behaviour
do indeed require diagnostics.
What brought you to that conclusion?
So be it.


So fix it. :-)

-Mike
Nov 13 '05 #30
"Peter Nilsson" <ai***@acay.com.au> wrote in message
news:3f******@news.rivernet.com.au...
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message
news:Pi**********************************@unix44.a ndrew.cmu.edu...
On Sat, 27 Sep 2003, Peter Nilsson wrote:
"Mike Wahler" <mk******@mkwahler.net> wrote...
> "Peter Nilsson" <ai***@acay.com.au> wrote...
> > "Jack Klein" <ja*******@spamcop.net> wrote...
> > >
> > > ... an implementation is NEVER required to diagnose
> > > undefined behavior.
I see now that I should have prefixed my reply...

Although, this is not true in general.
Restoring context:

Jack Klein wrote: ... an implementation is NEVER required to diagnose undefined behavior.
Peter Nillson replied: A constraint violation requires a diagnostic.
So you say you should have prefaced your reply with
"Although, this is not true in general."

Which gives us:

Jack Klein wrote: ... an implementation is NEVER required to diagnose undefined behavior.
Peter Nillson replied: Although, this is not true in general,
A constraint violation requires a diagnostic.
So in essence you just said, "What I'm about to say is
not true in general", and then made an assertion.
In which case I'd have expected you to at least
say under what circumstances it *is* true.

Don't bother, there are no such circumstances. When
I saw Jack make his assertion, I personally gave him
the credibility he's earned here. But 'just in case'
I checked the standard. It supports his statement
100%.

And how you got from 'undefined behavior' to
'constraint violation', I don't know. They're
two separate issues.

> > A constraint violation requires a diagnostic.
>
> Correct, but to which constraint violation do you refer?

Take your pick.


Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation.


And mine was made with that context removed. I wasn't trying to

misrepresent Jack, I was merely focusing on a statement which drew my attention.
Context is always important. Always.
So did you (Peter)
just randomly decide to explain under what conditions
diagnostics are required, just in case somebody didn't know?


Lose the 'randomly' and you have it.


So that gives us:

"So did you (Peter) just decide to explain under what conditions
diagnostics are required, just in case somebody didn't know?"

To which you now seem to be replying in the affirmative.
Perhaps you 'decided' to explain, but you never explained.
What conditions are they?

I decided to explain (rather poorly as it seems)
Not even poorly. An assertion is not an explanation.

Again, all you said was:
"A constraint violation requires a diagnostic."
That is not an explanation.
that certain forms of
undefined behaviour
Which 'certain forms'? Not only did you not explain,
you did not enumerate these forms.
do indeed *require* a diagnostic.
None do. If you feel otherwise, please cite them
along with supporting material from the standard.

[printf format
specifiers are not part of that list though.]


Of course not. No entity at all can be part of an empty set.

-Mike
Nov 13 '05 #31

On Sun, 28 Sep 2003, Peter Nilsson wrote:

"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote:
On Sat, 27 Sep 2003, Peter Nilsson wrote:
"Mike Wahler" <mk******@mkwahler.net> wrote...
> "Peter Nilsson" <ai***@acay.com.au> wrote...
> > "Jack Klein" <ja*******@spamcop.net> wrote...
> > >
> > > ... an implementation is NEVER required to diagnose
> > > undefined behavior.

[Peter should have said:]
Although, this is not true in general. > > A constraint violation requires a diagnostic.
Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation.
And mine was made with that context removed. I wasn't trying to misrepresent
Jack, I was merely focusing on a statement which drew my attention.

I decided to explain (rather poorly as it seems) that certain forms of
undefined behaviour do indeed *require* a diagnostic. [printf format
specifiers are not part of that list though.]


And I say again, *no*! Undefined behavior is by definition undefined,
and thus requires *nothing*, including diagnostics. Constraint
violations, OTOH, *do* require diagnostics. They're different
categories altogether, and AFAIK they're completely disjoint.

If you can come up with a construction which exhibits both a
constraint violation *and* undefined behavior, as part of the
same construct (I'm not really sure what that means anyway),
or an example of undefined behavior that requires a diagnostic,
then I'll have learned something. But AFAIK constraint violations
are one thing and undefined behavior is another thing, and never
the twain shall meet.

-Arthur

Nov 13 '05 #32
Arthur J. O'Dwyer wrote:

On Sun, 28 Sep 2003, Peter Nilsson wrote:

"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote:
On Sat, 27 Sep 2003, Peter Nilsson wrote:
> "Mike Wahler" <mk******@mkwahler.net> wrote...
> > "Peter Nilsson" <ai***@acay.com.au> wrote...
> > > "Jack Klein" <ja*******@spamcop.net> wrote...
> > > >
> > > > ... an implementation is NEVER required to diagnose
> > > > undefined behavior.
[Peter should have said:]
Although, this is not true in general.
> > > A constraint violation requires a diagnostic.

Okay, now *I'm* confused. Jack's statement was actually made
in the context of the C statement

printf("%%%%%") ;

which contains no constraint violation.


And mine was made with that context removed. I wasn't trying to misrepresent
Jack, I was merely focusing on a statement which drew my attention.

I decided to explain (rather poorly as it seems) that certain forms of
undefined behaviour do indeed *require* a diagnostic. [printf format
specifiers are not part of that list though.]


And I say again, *no*! Undefined behavior is by definition undefined,
and thus requires *nothing*, including diagnostics. Constraint
violations, OTOH, *do* require diagnostics. They're different
categories altogether, and AFAIK they're completely disjoint.

If you can come up with a construction which exhibits both a
constraint violation *and* undefined behavior, as part of the
same construct (I'm not really sure what that means anyway),
or an example of undefined behavior that requires a diagnostic,
then I'll have learned something. But AFAIK constraint violations
are one thing and undefined behavior is another thing, and never
the twain shall meet.


int array[1], *pointer = (char*)array;

--
pete
Nov 13 '05 #33
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote:

On Sun, 28 Sep 2003, Peter Nilsson wrote:

"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote:
> On Sat, 27 Sep 2003, Peter Nilsson wrote:
> > "Mike Wahler" <mk******@mkwahler.net> wrote...
> > > "Peter Nilsson" <ai***@acay.com.au> wrote...
> > > > "Jack Klein" <ja*******@spamcop.net> wrote...
> > > > >
> > > > > ... an implementation is NEVER required to diagnose
> > > > > undefined behavior.
[Peter should have said:]
Although, this is not true in general.
> > > > A constraint violation requires a diagnostic.

> Okay, now *I'm* confused. Jack's statement was actually made
> in the context of the C statement
>
> printf("%%%%%") ;
>
> which contains no constraint violation.


And mine was made with that context removed. I wasn't trying to misrepresent
Jack, I was merely focusing on a statement which drew my attention.

I decided to explain (rather poorly as it seems) that certain forms of
undefined behaviour do indeed *require* a diagnostic. [printf format
specifiers are not part of that list though.]


And I say again, *no*! Undefined behavior is by definition undefined,
and thus requires *nothing*, including diagnostics. Constraint
violations, OTOH, *do* require diagnostics. They're different
categories altogether, and AFAIK they're completely disjoint.

If you can come up with a construction which exhibits both a
constraint violation *and* undefined behavior, as part of the
same construct (I'm not really sure what that means anyway),
or an example of undefined behavior that requires a diagnostic,
then I'll have learned something. But AFAIK constraint violations
are one thing and undefined behavior is another thing, and never
the twain shall meet.


ISO/IEC 9899:1999
5.1.1.3 Diagnostics
[...]
2 EXAMPLE An implementation shall issue a diagnostic for the
translation unit:
char i;
int i;
because in those cases where wording in this International
Standard describes the behavior for a construct as being both
a constraint error and resulting in undefined behavior, the
constraint error shall be diagnosed.

Regards

Irrwahn
--
Great minds run in great circles.
Nov 13 '05 #34

On Sun, 28 Sep 2003, pete wrote:

Arthur J. O'Dwyer wrote:
On Sun, 28 Sep 2003, Peter Nilsson wrote:
> > > > "Jack Klein" <ja*******@spamcop.net> wrote...
> > > > >
> > > > > ... an implementation is NEVER required to diagnose
> > > > > undefined behavior. I decided to explain (rather poorly as it seems) that certain forms of
undefined behaviour do indeed *require* a diagnostic. [printf format
specifiers are not part of that list though.]
If you can come up with a construction which exhibits both a
constraint violation *and* undefined behavior, as part of the
same construct (I'm not really sure what that means anyway),
or an example of undefined behavior that requires a diagnostic,
then I'll have learned something. But AFAIK constraint violations
are one thing and undefined behavior is another thing, and never
the twain shall meet.


int array[1], *pointer = (char*)array;


Sorry, pete, I don't get it. Is the above undefined or
incorrect in some way?

And thanks, Irrwahn, for pointing out that such examples do
exist, somewhere -- or at least the Standard-writers thought
they did. :-)

-Arthur

Nov 13 '05 #35
On Sun, 28 Sep 2003 12:51:19 -0400 (EDT)
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote:

On Sun, 28 Sep 2003, pete wrote:

Arthur J. O'Dwyer wrote:
On Sun, 28 Sep 2003, Peter Nilsson wrote:
> > > > > "Jack Klein" <ja*******@spamcop.net> wrote...
> > > > > >
> > > > > > ... an implementation is NEVER required to diagnose
> > > > > > undefined behavior. I decided to explain (rather poorly as it seems) that certain
> forms of undefined behaviour do indeed *require* a diagnostic.
> [printf format specifiers are not part of that list though.] If you can come up with a construction which exhibits both a
constraint violation *and* undefined behavior, as part of the
same construct (I'm not really sure what that means anyway),
or an example of undefined behavior that requires a diagnostic,
then I'll have learned something. But AFAIK constraint violations
are one thing and undefined behavior is another thing, and never
the twain shall meet.
int array[1], *pointer = (char*)array;


Sorry, pete, I don't get it. Is the above undefined or
incorrect in some way?


array is an array of ints which is being cast to a char*
*pointer is a pointer to an int which is having a pointer to char
assigned to it.

IIRC you are not allowed to assign a pointer to char to another pointer
type without a cast and I don't think the conversion from int* -> char*
-> int* is guaranteed.
And thanks, Irrwahn, for pointing out that such examples do
exist, somewhere -- or at least the Standard-writers thought
they did. :-)


People are infinitely imaginative when it comes to finding ways to do
things wrong :-)
--
Mark Gordon
Paid to be a Geek & a Senior Software Developer
Although my email address says spamtrap, it is real and I read it.
Nov 13 '05 #36
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message news:<Pi***********************************@unix47 .andrew.cmu.edu>...
On Sun, 28 Sep 2003, pete wrote:

Arthur J. O'Dwyer wrote:
On Sun, 28 Sep 2003, Peter Nilsson wrote:
> > > > > "Jack Klein" <ja*******@spamcop.net> wrote...
> > > > > >
> > > > > > ... an implementation is NEVER required to diagnose
> > > > > > undefined behavior. I decided to explain (rather poorly as it seems) that certain forms of
> undefined behaviour do indeed *require* a diagnostic. [printf format
> specifiers are not part of that list though.] If you can come up with a construction which exhibits both a
constraint violation *and* undefined behavior, as part of the
same construct (I'm not really sure what that means anyway),
or an example of undefined behavior that requires a diagnostic,
then I'll have learned something. But AFAIK constraint violations
are one thing and undefined behavior is another thing, and never
the twain shall meet.

So when you see a required diagnostic, it's invariably your belief
that the code is well defined and the warning/error is spurious and
purely there because the standard writers thought the compiler should
say something of no practical significance?!!
And thanks, Irrwahn, for pointing out that such examples do
exist, somewhere -- or at least the Standard-writers thought
they did. :-)


You have Mike to thank for the quote originally. In some random act of
madness you decided to snip it when I first ticked it as a suitable
example! ;)

If you want another I pulled up the very first constraint header 6.4p2
and took about half a second to come up with...

putchar('x);

Such examples are not hard to conceive!

My original point was that a required diagnostic is, more often than
not, as much for the undefined behaviour as for the constraint
violation. Certainly, that's how I've always perceived compiler
errors.

I concede that not all constraint violations are ex-officio invokers
of undefined behaviour. Clearly I got it wrong as a language lawyer.

But I have to ask both Mike and yourself, what do you think
constraints are for? Why bother with them if they only report well
defined code?

--
Peter
Nov 13 '05 #37
ur absolutely *moron* ,stupid .
ru**@webmail.co.za (goose) wrote in message news:<ff**************************@posting.google. com>...
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
hello,
response if u ,on all level of questions:::


idiot!!!
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself?
2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
3.why :: printf("%%%%%") ; output %%%.
4.how 2 run a .obj file without previously creating any .exe?
5.what is classical class?(FOR C++)


by now you should have realised that no one in this
group will do your homework for you. trying to engage
them with "expert" questions only further enrages the
regulars.

goose,
did you even read the faq for clc yet ?

Nov 13 '05 #38

On Sun, 28 Sep 2003, Peter Nilsson wrote:

Arthur J. O'Dwyer wrote...
On Sun, 28 Sep 2003, pete wrote:
Arthur J. O'Dwyer wrote:
> If you can come up with a construction which exhibits both a
> constraint violation *and* undefined behavior, as part of the
> same construct (I'm not really sure what that means anyway),
> or an example of undefined behavior that requires a diagnostic,
> then I'll have learned something. But AFAIK constraint violations
> are one thing and undefined behavior is another thing, and never
> the twain shall meet.
So when you see a required diagnostic, it's invariably your belief
that the code is well defined
Depends what you mean. My computer is physically incapable of
producing "undefined" byte values, so my source code is always
well-defined. Of course, if one of my programs violates a
constraint, then my C compiler issues a diagnostic and refuses
to compile the code, as required and allowed, respectively, by
the Standard. So there does not exist any "program", nor any
"behavior", defined or otherwise, associated with a program
which is not correct C. IMHO.
and the warning/error is spurious
'Course not! The error would specify (if I'm lucky) which
constraint had been violated, so I could fix it.
and purely there because the standard writers thought the
compiler should say something of no practical significance?!!
That doesn't make sense. A "C program" which does not compile
is not, technically speaking, a C program. It's *almost* a
program, but if it's not something that a C compiler can accept,
then I wouldn't call it a C program. And in this newsgroup, we
only talk about the "(un)defined behavior" of C programs.
And thanks, Irrwahn, for pointing out that such examples do
exist, somewhere -- or at least the Standard-writers thought
they did. :-)


You have Mike to thank for the quote originally. In some random act of
madness you decided to snip it when I first ticked it as a suitable
example! ;)


Did you? Sorry.
If you want another I pulled up the very first constraint header 6.4p2
and took about half a second to come up with...

putchar('x);
How does that invoke UB? In fact, how exactly does that violate
a constraint? I'm having a hard time reading the Standard tonight;
I know there's some prohibition about unterminated character constants
in there somewhere, but I can't find it...

My original point was that a required diagnostic is, more often than
not, as much for the undefined behaviour as for the constraint
violation. Certainly, that's how I've always perceived compiler
errors.
Nope. UB was basically left "undefined" *because* it was so hard
to diagnose. Stuff like modifying string literals, for example.
If it's easy for the compiler to catch, it's almost always given
as a constraint.

But I have to ask both Mike and yourself, what do you think
constraints are for? Why bother with them if they only report well
defined code?


They don't report well-defined code; they report text which is *not*
code -- not C code, anyways. As I see it (slight repetition of above),
we have:

"C programs" with constraint violations: do not compile, thus
are not *really* written in C. E.g., your average C++
program violates several constraints. So does your average
Shakespearean sonnet. So do lots of things that *look* very
similar to real C programs, but contain typos or "thinkos."
C programs which exhibit undefined behavior. These programs
aren't required to elicit diagnostics, but their exact
behavior isn't defined either.
C programs without undefined behavior, which of course can be
further broken down into "conforming," "strictly conforming,"
et cetera. These are programs that AFAIK must always
compile and execute "correctly," without refusing to compile
or blowing things up.

HTH,
-Arthur
Nov 13 '05 #39
"ROSY" <de**************@rediffmail.com> wrote in message
news:73**************************@posting.google.c om...
ur absolutely *moron* ,stupid .


Now *that* is the way to get folks to help you.

Perhaps if you came back to reality, you might
realize that Joona is one of the brighter folks
around here and could give you lots of quality
help. But I doubt he'll be inclined to when
you insult him.

Good luck!
-Mike
Nov 13 '05 #40

"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message
news:Pi**********************************@unix46.a ndrew.cmu.edu...

On Sun, 28 Sep 2003, Peter Nilsson wrote:

Arthur J. O'Dwyer wrote...
On Sun, 28 Sep 2003, pete wrote:
> Arthur J. O'Dwyer wrote:
> > If you can come up with a construction which exhibits both a
> > constraint violation *and* undefined behavior, as part of the
> > same construct (I'm not really sure what that means anyway),
> > or an example of undefined behavior that requires a diagnostic,
> > then I'll have learned something. But AFAIK constraint violations
> > are one thing and undefined behavior is another thing, and never
> > the twain shall meet.
So when you see a required diagnostic, it's invariably your belief
that the code is well defined


Depends what you mean. My computer is physically incapable of
producing "undefined" byte values, so my source code is always
well-defined. Of course, if one of my programs violates a
constraint, then my C compiler issues a diagnostic and refuses
to compile the code, as required and allowed, respectively, by
the Standard. So there does not exist any "program", nor any
"behavior", defined or otherwise, associated with a program
which is not correct C. IMHO.
and the warning/error is spurious


'Course not! The error would specify (if I'm lucky) which
constraint had been violated, so I could fix it.
and purely there because the standard writers thought the
compiler should say something of no practical significance?!!


That doesn't make sense. A "C program" which does not compile
is not, technically speaking, a C program. It's *almost* a
program, but if it's not something that a C compiler can accept,
then I wouldn't call it a C program. And in this newsgroup, we
only talk about the "(un)defined behavior" of C programs.
And thanks, Irrwahn, for pointing out that such examples do
exist, somewhere -- or at least the Standard-writers thought
they did. :-)


You have Mike to thank for the quote originally. In some random act of
madness you decided to snip it when I first ticked it as a suitable
example! ;)


Did you? Sorry.
If you want another I pulled up the very first constraint header 6.4p2
and took about half a second to come up with...

putchar('x);


How does that invoke UB?


6.4 Lexical elements

Constraints

2 Each preprocessing token that is converted to a token shall
have the lexical form of a keyword, an identifier, a constant,
a string literal, or a punctuator.

Semantics

3 A token is the minimal lexical element of the language in
translation phases 7 and 8. The categories of tokens are:
keywords, identifiers, constants, string literals, and
punctuators. A preprocessing token is the minimal lexical
element of the language in translation phases 3 through 6.
The categories of preprocessing tokens are: header names,
identifiers, preprocessing numbers, character constants,
string literals, punctuators, and single non-white-space
characters that do not lexically match the other preprocessing
token categories. If a ' or a " character matches the last
category, the behavior is undefined. Preprocessing tokens <<<=====
can be separated by white space; this consists of comments
(described later), or white-space characters (space, horizontal
tab, new-line, vertical tab, and form-feed), or both. As
described in 6.10, in certain circumstances during translation
phase 4, white space (or the absence thereof) serves as more
than preprocessing token separation. White space may appear
within a preprocessing token only as part of a header name
or between the quotation characters in a character constant
or string literal.
In fact, how exactly does that violate
a constraint?
AFAICT it doesn't.
I'm having a hard time reading the Standard tonight;
I know there's some prohibition about unterminated character constants
in there somewhere, but I can't find it...


See above.

-Mike
Nov 13 '05 #41
Arthur J. O'Dwyer wrote:

On Sun, 28 Sep 2003, pete wrote:

Arthur J. O'Dwyer wrote:
On Sun, 28 Sep 2003, Peter Nilsson wrote:
> > > > > "Jack Klein" <ja*******@spamcop.net> wrote...
> > > > > >
> > > > > > ... an implementation is NEVER required to diagnose
> > > > > > undefined behavior. I decided to explain (rather poorly as it seems) that certain forms of
> undefined behaviour do indeed *require* a diagnostic. [printf format
> specifiers are not part of that list though.] If you can come up with a construction which exhibits both a
constraint violation *and* undefined behavior, as part of the
same construct (I'm not really sure what that means anyway),
or an example of undefined behavior that requires a diagnostic,
then I'll have learned something. But AFAIK constraint violations
are one thing and undefined behavior is another thing, and never
the twain shall meet.


int array[1], *pointer = (char*)array;


Sorry, pete, I don't get it. Is the above undefined or
incorrect in some way?


N869
6.5.16.1 Simple assignment
Constraints
[#1] One of the following shall hold:
-- the left operand has qualified or unqualified
arithmetic type and the right has arithmetic type;
-- the left operand has a qualified or unqualified version
of a structure or union type compatible with the type
of the right;

-- both operands are pointers to qualified or unqualified
versions of compatible types, and the type pointed to
by the left has all the qualifiers of the type pointed
to by the right;
-- one operand is a pointer to an object or incomplete
type and the other is a pointer to a qualified or
unqualified version of void, and the type pointed to by
the left has all the qualifiers of the type pointed to
by the right; or
-- the left operand is a pointer and the right is a null
pointer constant.
-- the left operand has type _Bool and the right is a
pointer.

--
pete
Nov 13 '05 #42
Mike Wahler wrote:
"ROSY" <de**************@rediffmail.com> wrote in message
ur absolutely *moron* ,stupid .


Now *that* is the way to get folks to help you.


How come you haven't PLONKED it? If it never gets any responses
it will eventually go away.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 13 '05 #43

On Mon, 29 Sep 2003, CBFalconer wrote:

Mike Wahler wrote:
[re: ROSY]
Now *that* is the way to get folks to help you.


How come you haven't PLONKED it? If it never gets any responses
it will eventually go away.


IMHO, ignoring ignorant-type trolls (as opposed to joyriding-type
trolls) often doesn't help. And I do take exception to the many
posters in this thread who respond publicly *only* to quote all
or part of the message, followed by "*PLONK*". That doesn't do
anything useful, guys. If we wanted to know the minutiae of your
client-side filtering system, we'd read your blog. Just plonk
quietly and move on, please.

As for me, I'm enjoying ROSY's colloquy. I particularly like the
mental imagery associated with the repeated idiom "spoke ur nose",
and the Babylonian-l33tsp33k effect of "R u harlot!!!" is really
masterful. You guys don't know what you're missing. :-)

-Arthur
Nov 13 '05 #44
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message news:<Pi**********************************@unix46. andrew.cmu.edu>...
"C programs" with constraint violations: do not compile,
Chapter and Verse please.

Every one of my compilers successfully translates...

unsigned char *p = 0xFFFE;

The #error directive (not excluded by #if) is the *only* construct in
which an implementation *must* fail to translate a program.

You have heard that Fortran programs are conforming C programs,
haven't you?

The failure to translate a program to an executable is the most common
form of undefined behaviour, but like every other form undefined
behaviour, it is not a general *requirement*.
thus are not *really* written in C.

<sigh>

You'll have to define what YOU mean by a "real" C program. A
'conforming' program can be pretty much anything. Implementations
would have a hard time selling to the commercial world if they could
only translate strictly conforming programs.

--
Peter
Nov 13 '05 #45
"Arthur J. O'Dwyer" wrote:
On Mon, 29 Sep 2003, CBFalconer wrote:
Mike Wahler wrote:
[re: ROSY]
Now *that* is the way to get folks to help you.
How come you haven't PLONKED it? If it never gets any responses
it will eventually go away.


IMHO, ignoring ignorant-type trolls (as opposed to joyriding-type
trolls) often doesn't help. And I do take exception to the many
posters in this thread who respond publicly *only* to quote all
or part of the message, followed by "*PLONK*". That doesn't do
anything useful, guys. If we wanted to know the minutiae of your
client-side filtering system, we'd read your blog. Just plonk
quietly and move on, please.


My reasoning is that it should at least know its being PLONKED.
It may eventually find out what that means. I then have no
further urge to clutter the newsgroup.

As for me, I'm enjoying ROSY's colloquy. I particularly like the
mental imagery associated with the repeated idiom "spoke ur nose",
and the Babylonian-l33tsp33k effect of "R u harlot!!!" is really
masterful. You guys don't know what you're missing. :-)


IIRC it (ROSY) was originally posting cross-posted. Maybe t'other
newsgroup is more suitable for your amusement? I'm sure it is not
hard to excite ROSY. :-)

I am not trying to start any argument. Just stating views.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 13 '05 #46
Peter Nilsson wrote:
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message
news:<Pi**********************************@unix46. andrew.cmu.edu>...
"C programs" with constraint violations: do not compile,


Chapter and Verse please.

Every one of my compilers successfully translates...

unsigned char *p = 0xFFFE;

The #error directive (not excluded by #if) is the *only* construct in
which an implementation *must* fail to translate a program.


I'm not convinced that the implementation /must/ fail to translate a program
under this circumstance. Do you have C&V?

The closest I can find is this:

"A preprocessing directive of the form

# error pp-tokens<opt> new-line

causes the implementation to produce a diagnostic message that includes the
specified sequence of preprocessing tokens."

Nothing there about terminating the program. What did I miss?

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #47
Richard Heathfield <do******@address.co.uk.invalid> writes:
Peter Nilsson wrote:

[...]
The #error directive (not excluded by #if) is the *only* construct in
which an implementation *must* fail to translate a program.


I'm not convinced that the implementation /must/ fail to translate a program
under this circumstance. Do you have C&V?

The closest I can find is this:

"A preprocessing directive of the form

# error pp-tokens<opt> new-line

causes the implementation to produce a diagnostic message that includes the
specified sequence of preprocessing tokens."

Nothing there about terminating the program. What did I miss?


Section 4 (Conformance), paragraph 4:

The implementation shall not successfully translate a
preprocessing translation unit containing a #error preprocessing
directive unless it is part of a group skipped by conditional
inclusion.

--
Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 13 '05 #48
de**************@rediffmail.com (ROSY) wrote in message news:<73**************************@posting.google. com>...
hello,
response if u ,on all level of questions:::
1.how a self deletable .exe file deleted on some future date & time
without
invoking the .exe itself? 2.if we want that any wildcard characters in command line arguments
should be appropriately expanded,are we reqd. 2 make any special
provision?if yes,which?
3.why :: printf("%%%%%") ; output %%%.
4.how 2 run a .obj file without previously creating any .exe?
5.what is classical class?(FOR C++)

bye,


When I first checked out the heading of your thread. I thought better
stay out of this iman, you haven't coded much since long time and you
might end up making a fool out of yourself. Well after reading it I
know it was the other way around thanks for helping me make me a
confident man again. You did what Oprah could not do.

Please read the FAQ before you post to a group. Many groups have it
c.l.c also has it.

BTW I have a reason to belive this is your first "expert job
assignment at ISRO".

--
Imanpreet Singh Arora
imanpreet_arora AT yahoo DOT co DOT in

What I can't create, I can't understand.
-- Richard Feynman
Nov 13 '05 #49
In <63**************************@posting.google.com > ai***@acay.com.au (Peter Nilsson) writes:
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message news:<Pi**********************************@unix46. andrew.cmu.edu>...
"C programs" with constraint violations: do not compile,


Chapter and Verse please.

Every one of my compilers successfully translates...

unsigned char *p = 0xFFFE;


I wouldn't say that a translation that has generated a mandatory
diagnostic qualifies as successful: the standard doesn't guarantee
*anything* at all about the generated code. And, as far as I know,
the compilers' documentation provides no guarantees, either.
thus are not *really* written in C.

<sigh>

You'll have to define what YOU mean by a "real" C program.


That's easy: a program that doesn't require any diagnostic and that
doesn't invoke any form of undefined behaviour that can be detected at
translation time.

I prefer the term "correct C program", as defined by C99, which is a bit
more restrictive.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Boris Ammerlaan | last post by:
This notice is posted about every week. I'll endeavor to use the same subject line so that those of you who have seen it can kill-file the subject; additionally, Supersedes: headers are used to...
102
by: dreamznatcher | last post by:
Hello, I'm considering a career switch to a more database-related job, but need help on a few questions and issues. I'm a Computer Engineering graduate and have always felt most comfortable...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.