DATETIME like YYYYMMDDHHMMSS

A

Attila Feher

Peter said:
So by your definition only code that can be found in verbatim in the
C++ standard and what the C++ standard explicitly states to be the
best "C++ design" can be considered C++ code?

Please quote me where I say that.
Interesting definition,

You made it.
but that leaves very few code that can be considered C++.

Well, so why did you make it.
In fact I
don't remember reading anywhere in the C++ standard about code
considered to be the best "C++ design".

Nope. Neither did I say you did or even that it does contain it. But I bet
you did read it elsewhere.
Could you tell in which
paragraphs of the C++ standard statements like this are made?

The first such artifact - produced by WG21 -, which talks about programming
and not the programming language is the Perfomance TR. So to answer you:
most probably none.

As whole the whole thread of attacks on me. I have tried to point out that
the given code was pure C. Which (at some time) was the normal thing to do
here, but those who posted the code. I have never stated that it does not
compile with a C++ compiler. But since C++ maintains a CLOSE compatibility
with C, I doubt that it should be a surprise that C code compiles as C++,
and for most it does the same thing.

I always am amazed how offensive people can get and how much they disregard
the other opinion... with minor issues. The issue is LONG time solved. I
have tested a little that how long (even Mike, who used to be immune) can
people go on without realizing that what I am talking about is not what they
talk about. How long are they going to defend a design as C++ while it is
clearly a C design. Long. Too long for me. So me bail out.
 
A

Attila Feher

Peter said:
See above...

I see no definition. And I see you have got to the stage where you do not
even read the post, only to the point of possible disagreement. Then what
for?
 
M

Mike Wahler

Attila Feher said:
I am not qualified to decide that.


And which word of the above don't you understand?

I believe I understand it. You don't call it C++ code.
Yet it is. It's is C++ (and C).
Especially pointing out
where does it talked about vailidity.

Validity (of the code as C++) is what I'm talking about.
Oh boy. You used to be a reasonable person.

As did you. :)
Which isn't what you have implied I said.

I didn't imply anything. I simply quoted you.
Valid as C++, but it is C.

It is *both*. That's is my point.
You did:

And what I said is that I would not call it C++. So?

So it *is* C++ (and C).
And yet, it is pure C.

And it is also pure C++.
Do you have your "disagreement" bit stuck?

As stuck as yours. :)
What is C, is C.

Yes. And quite a bit of C code also qualifies as C++.
And it may happen to compile as C++ (according to the
standard). It may even do the same thing as in C, when compiled with a C++
compiler. Yet, it is C.

As well as C++.
And I have specifically stated that I was talking about one quality of that
code: that it is C code.

But that assessment is incomplete. Is is also equally valid C++ code.
You mentioned 'quality' a while back. I already responded that 'quality'
is not part of my argument.

-Mike
 
W

White Wolf

Mike said:
I 'misspoke' on this. I meant it doesn't qualify as "C but not C++".

I love these random quotes...

I did not mean it will not compile on a C++ compiler. I guess when I say
C++ code (in the realm of this NG) I mean a bit more(*) "than just code
well-formed code which does not invoke undefined behavior and implementation
defined behavior which may alter its meaning".

(*) It more on contraints, so less code qualifies as C++ with that
definition.
 
M

Mike Wahler

Attila Feher said:
Please quote me where I say that.


You made it.


Well, so why did you make it.


Nope. Neither did I say you did or even that it does contain it. But I bet
you did read it elsewhere.


The first such artifact - produced by WG21 -, which talks about programming
and not the programming language is the Perfomance TR. So to answer you:
most probably none.

As whole the whole thread of attacks on me.

I won't presume to speak for others, but please not that I
have *never* attacked *you*, only your ideas. There's a
big difference. I do respect you as a person, but I disagree
with your statements (this time, usually we've seemed to agree
in the past).
I have tried to point out that
the given code was pure C.

It is equally pure C++.
Which (at some time) was the normal thing to do
here, but those who posted the code. I have never stated that it does not
compile with a C++ compiler.

Which to me is an admission that it is indeed C++ code.
But since C++ maintains a CLOSE compatibility
with C, I doubt that it should be a surprise that C code compiles as C++,

Some does, some does not.
and for most it does the same thing.

Sometimes it will, other times not.
I always am amazed how offensive people can get

If you feel that disagreements about your ideas is 'offensive',
I cannot help that. My intention is simply to debate your ideas,
not to offend you or anyone.

and how much they disregard
the other opinion...

If I disregarded your opinion, I would not be debating it.
with minor issues. The issue is LONG time solved. I
have tested a little that how long (even Mike, who used to be immune) can
people go on without realizing that what I am talking about is not what they
talk about.

Perhaps I am indeed misunderstanding you, but so far I don't think so.
How long are they going to defend a design


Design does not enter into my arguments. Only the validity of
a piece of code with regard to 14882. Poor (or good) design
can be done in any language.
as C++ while it is
clearly a C design.

The term "C design" (or _insert_language_here design) is meaningless
to me.
Long. Too long for me. So me bail out.

Me too. We're accomplishing nothing with this debate.
Again, I'm not attacking you, just these particular
opinions of yours. Let's move on to something else,
shall we?

-Mike
 
W

White Wolf

Mike said:
I believe I understand it. You don't call it C++ code.
Yet it is. It's is C++ (and C).

It being C what makes it valid C++, not it being C++. I cannot explain it
any better.
Validity (of the code as C++) is what I'm talking about.

Yep. I understand. But that is not what I was talking about when you have
chosen to contradict me, without trying to understand what I mean - which is
rather unusual from you.
As did you. :)

I had a filter installed, but my licence expired. ;-)
I didn't imply anything. I simply quoted you.

You implied, that when I say "I would not call it C++" I mean that it is not
according to the C++ standard. Which I have clearly(?) and already 50 times
repeatedly explained that it is not so. Can I lift 150 kilograms? No.
Does it mean it is impossible? No. In this context, in this newsgroup, I
make a strict difference between code which uses C++ style and idioms and
code which does not, for example which is pure C.
It is *both*. That's is my point.

Mine too. Except that I am not surprised, as most of C is a subset of C++.
Therefore what I say is that the standard calls it C++ not because it is
C++, but because it is C. And the standard keeps compatibility with C -
where possible.
So it *is* C++ (and C).

It is C, which happens to also be C++. Stress on the first part of the
sentence.
And it is also pure C++.

Because it is C, and not because it is C++.
As stuck as yours. :)

I completely agree with myself. ;-)
Yes. And quite a bit of C code also qualifies as C++.

The reason not being because it is C++, but because it is C.
As well as C++.

Which stems from the fact that it is C. Nothing makes it more C++ than C.
Being C is the root of it being C++.
But that assessment is incomplete. Is is also equally valid C++ code.
You mentioned 'quality' a while back. I already responded that 'quality'
is not part of my argument.

But that was the point of mine, to which you have originally reacted to.

Would I be shorter and had I more oil companies, I could be US president.
 
M

Mike Wahler

White Wolf said:
I love these random quotes...

I did not mean it will not compile on a C++ compiler. I guess when I say
C++ code (in the realm of this NG) I mean a bit more(*) "than just code
well-formed code which does not invoke undefined behavior and implementation
defined behavior which may alter its meaning".

(*) It more on contraints, so less code qualifies as C++ with that
definition.

So here's the crux: our definitions of what C++ is differs.
My meaning is: "does not violate requirements or constraints
imposed by 14882). Iterestingly, this does not preclude
syntactically correct code which produces undefined behavior.
Such code *is* C++, although it's certainly not 'good' code.

-Mike
 
W

White Wolf

Mike said:
I won't presume to speak for others, but please not that I
have *never* attacked *you*, only your ideas. There's a
big difference. I do respect you as a person, but I disagree
with your statements (this time, usually we've seemed to agree
in the past).

That part was somehow garbled beyond recognition.
It is equally pure C++.

Because it is C.
Which to me is an admission that it is indeed C++ code.

Again, you take a different definition to what is C++ that what I do. Since
C (mostly) is a subset of C++ most C code will qualify as C++. And yet, it
won't be what should be taught as C++ to beginners.
Some does, some does not.

OK, double that that.
Sometimes it will, other times not.


Most I said, not all.
If you feel that disagreements about your ideas is 'offensive',
I cannot help that. My intention is simply to debate your ideas,
not to offend you or anyone.

Yeah. I fell that I should really learn the difference between offensive
and defensive... Which is of course what I wanted to write. Welcome to the
nightmares of someone not from an Indogerman language nation...
If I disregarded your opinion, I would not be debating it.

Actually the trouble is that you debate yours. So far we have not discussed
my opinion, altough I have tried to bring it back to focus few million
times. :)
Perhaps I am indeed misunderstanding you, but so far I don't think so.

And I cannot help about that.
Design does not enter into my arguments. Only the validity of
a piece of code with regard to 14882. Poor (or good) design
can be done in any language.

And yet, there is code which one calls C design and there is code which one
calls C++ design. And since this isn't comp.std.c++ I am afraid that we
shall we talk about the /use/ of the language as well as its meaning (or
standard).
The term "C design" (or _insert_language_here design) is meaningless
to me.

Again, I feel that bit stuck.
Me too. We're accomplishing nothing with this debate.
Again, I'm not attacking you, just these particular
opinions of yours. Let's move on to something else,
shall we?


Unfortunately it is not a debate. :-( You are talking about something
completely different than I do.
 
W

White Wolf

Mike said:
So here's the crux: our definitions of what C++ is differs.
My meaning is: "does not violate requirements or constraints
imposed by 14882). Iterestingly, this does not preclude
syntactically correct code which produces undefined behavior.
Such code *is* C++, although it's certainly not 'good' code.

Useless C++, yes. But aren't we here to discuss useful ideas, and ideas
which (if necessary/possible) use the full power of the language?
 
M

Mike Wahler

White Wolf said:
Useless C++, yes. But aren't we here to discuss useful ideas,
and ideas
which (if necessary/possible) use the full power of the language?

It's not always necessary to harness the full power in order
to get certain things done. I find that John's solution does
get the job done. Whether it's the 'best' way, I don't know,
since I don't know OP's specific criteria, if any.

-Mike
 
K

Karl Heinz Buchegger

White said:
[snip]

Yep. I understand. But that is not what I was talking about when you have
chosen to contradict me, without trying to understand what I mean - which is
rather unusual from you.

Excuse me for bailing in.
I think we all understood what you were trying to say.
But we don't agree (me too) with the wording you choosed.

<Quote from your response which started that all>
Which part of the above is C++?
</Quote>

What you should have said IMHO is this:
"While this is valid C++, it is not the recommended way to
do this in C++. In C++ we usually use streams instead of
the error prone printf() family of functions"

Attila, you want your response be seen in that way, while others
take your original response literally and argue that the posted
solution is perfectly valid C++ (from the language point of view).

I think there is no disagreement with the people you argue with,
that indeed in C++ the posted solution is a valid one although not
one a C++ coder would (or should) use.

Can all agree to that?
 
O

Old Wolf

White Wolf said:
I see. Using sprintf, on a limited size buffer and there is no opportunity
of buffer overflow. Which C++ standard? Todays? 5 years from now? 50
years from now?

The standard won't change to break old but conforming code.
IMHO it's more likely that the standard libraries relating to
time will break backwards compatibility, than sprintf.

In fact there would be a buffer problem if someone changed their
computer clock to the year 10000; you can fix this by increasing
the buffer size.
Yes. And that is why a pure C code needs explanation, telling why is it
posted to a C++ group. It may be the best C++ implementation possible. It
may not. But many people work on getting people to do C++ programming in
C++, and it does not do any justice to their work if others post pure C code
as C++.

Who was unjustly treated here? Until a few hours ago, John Harrison's
code is the only posted code that answers the OP's question.
And as he himself pointed out, nobody is trying to say that it is
the best solution. FWIW John's solution is about half the size
of Gary Labowitz's.

C++ is often referred to as a 'multi-paradigm' langauge. IMHO
it's silly to cut one paradigm out just because there is another
one available. It's like refusing to buy a coping-saw because
you already have a hacksaw.
But the answer which says, yeah it is also C++, is the wrong
answer. It sounds a lot like: Why did I do it? Because I could.

More like: Why did I do it? Because it is simple and it works.

If the question was: "Write a program that returns 42 to the OS"
would you reject:
int main() { return 42; }
as being "un-C++" ?
 
G

Gary Labowitz

<<snip>>
I finally got unlazy and checked Stroustrup. He says:

Because C++ and C code are often intermixed, C++ stream I/O is sometimes
mixed with the C printf() family of I/O functions. The Cstyle I/O functions
are presented by <cstdio> and <stdio.h>. Also, because C functions can be
called from C++ some programmers may prefer to use the more familiar C I/O
functions. Even if you prefer stream I/O, you will undoubtedly encounter
Cstyle I/O at some time.
[page 651]

It would appear he makes a distinction between C++ code (using I/O streams)
and C code (printf() family of I/O functions). C++ compilers provide support
of C code for backward compatibility (BC), and the framers of the standand
included it to ensure that the BC would be there. Mistakenly, in my opinion.
But as long as all the C-style string usage isn't completely replaced with
C++ equivalents, the BC support will have to remain. Perhaps forever. Thus,
stuff like c_str(), etc.

</rhetorical>
Of course, by the same argument, we should elimnate arrays, too. Or would
that break too much current C++ code?
</rhetorical>
 
W

White Wolf

Karl said:
White said:
[snip]

Yep. I understand. But that is not what I was talking about when you
have chosen to contradict me, without trying to understand what I mean
- which is rather unusual from you.

Excuse me for bailing in.
I think we all understood what you were trying to say.
But we don't agree (me too) with the wording you choosed.

<Quote from your response which started that all>
Which part of the above is C++?
</Quote>

What you should have said IMHO is this:
"While this is valid C++, it is not the recommended way to
do this in C++. In C++ we usually use streams instead of
the error prone printf() family of functions"

Attila, you want your response be seen in that way, while others
take your original response literally and argue that the posted
solution is perfectly valid C++ (from the language point of view).

I think there is no disagreement with the people you argue with,
that indeed in C++ the posted solution is a valid one although not
one a C++ coder would (or should) use.

Can all agree to that?

"Which part of the above is C++?" was a bit meant to see who will jump.
What it did mean - and was meant to convey to those who chose to
understand - is C++ a.k.a. not C, a.k.a. better C, a.k.a. more than C etc.
My point was not more than getting half of what you have said. I do not say
for certain, that a C++ coder would or should not use the code... there may
be valid reasons to use it. But yet, since this NG spells C++, it is always
a good idea to mention if a code is made with C compatibility in mind.

--
WW aka Attila
:::
Usenet is like a herd of performing elephants with diarrhea - massive,
difficult to redirect, awe-inspiring, entertaining, and a source of mind -
boggling amounts of excrement when you least expect it. - Gene
Spafford,1992
 
W

White Wolf

Old said:
The standard won't change to break old but conforming code.
IMHO it's more likely that the standard libraries relating to
time will break backwards compatibility, than sprintf.

In fact there would be a buffer problem if someone changed their
computer clock to the year 10000; you can fix this by increasing
the buffer size.

Runtime? And you are concentrating on changing the standard library only.
Other parts of the code may change as well.
C++ is often referred to as a 'multi-paradigm' langauge. IMHO
it's silly to cut one paradigm out just because there is another
one available. It's like refusing to buy a coping-saw because
you already have a hacksaw.

And yet, it does not hurt to mention that the code is pure C. Which is not
necessarily any decision about any quality in itself. Only a fair reminder.
More like: Why did I do it? Because it is simple and it works.

There are differences between simple and simple.
If the question was: "Write a program that returns 42 to the OS"
would you reject:
int main() { return 42; }
as being "un-C++" ?

If you cared to read my posts, you would find the answer in a reply to Mike.

Since I have absolutely zero stamina please forgive me that I am really not
going to keep answering the same things anymore. I think I have done what I
possibly could to politely tell that you have all misunderstood my
intentions. Either you can accept that or keep arguing, but please solve it
without me. I have carpal, so this sub-thread hurts me double. :-(

So all of you please have a nice time, I regard this discussion as one which
has ended.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top