strdup in c++

R

Ron Natalie

Gianni Mariani said:
For the longest time C was a defacto standard. In fact even now, C was
for a longer time NOT a standard that it is a standard without any help
from a standards body.

I have been programming C since 1977. I am well aware of the history.
We've had a standard for over ten years for C. strdup is not now nor has
it ever been part of it. As a matter of fact, if you were to define a function
called strdup, you'd be in violation of the standard.
 
G

Gianni Mariani

Ron said:
I have been programming C since 1977. I am well aware of the history.
We've had a standard for over ten years for C. strdup is not now nor has
it ever been part of it. As a matter of fact, if you were to define a function
called strdup, you'd be in violation of the standard.

That's all very nice ... and totally meaningless in this discussion.

Disclaimer: In no way am I advocating people use strdup.

What I am saying is that it DOES EXIST and it is well known what it
should do. THEREFORE: answers to arguments about wether you need to use
new/delete or malloc/free are well defined. A corollary is that anyone
who would implement/suggest that strdup does something differently and
incompatible needs a brain adjustment.

If you can't agree with the statement above, we'll just have to agree to
disagree because right now I can't see how someone reasonable could
disagree and be reasonable.
 
G

Gianni Mariani

Ron said:
What is in the man page for strdup?

Lifted from the man page:

The strdup() function returns a pointer to a new string which is a
duplicate of the string s. Memory for the new string is obtained with
malloc(3), and can be freed with free(3).


Despite whatever you are
looking at, strdup is not addressed by any C or C++ standard.

That's nice.
 
R

Ron Natalie

Gianni Mariani said:
What I am saying is that it DOES EXIST and it is well known what it
should do.

It is not well known in the terms of C or C++. It is only well known in
the terms of certain UNIX-like systems. If you want to persue this
silly assed line of logic further, take it to comp.os.unix.
 
R

Ron Natalie

Gianni Mariani said:
Lifted from the man page:

The strdup() function returns a pointer to a new string which is a
duplicate of the string s. Memory for the new string is obtained with
malloc(3), and can be freed with free(3).
What bearing does that have to do with standard C or C++.
Despite whatever you are

That's nice.
Not only is it nice, it's fucking topical. Despite the fact I've been
working with UNIX and C since 1977, I've also worked with C and
C++ on a half dozen operating systems that didn't pretend to be
UNIX. If you want to drivel on about POSIX, take it to a UNIX
group.
 
G

Gianni Mariani

Ron said:
It is not well known in the terms of C or C++. It is only well known in
the terms of certain UNIX-like systems. If you want to persue this
silly assed line of logic further, take it to comp.os.unix.


This all started becuase of this:

Ron Natalie wrote:
....
They have to supply malloc / free. There's no telling what the
function strdup() requires because there's no such function in
standard C or C++.

The world is much bigger than the C and C++ standards. Spreading
mis-information about other facets is just plain wrong.

If you wish to hold this NG as close to the C++ standard as possible
that's an admirable goal but PLEASE refrain from discussing anything
else like you have above and we'll then be able to limit the "silly
assed" logic as you so nicely put it.
 
A

Alexander Terekhov

Ron Natalie wrote:
[...]
Not only is it nice, it's fucking topical.

Bah bah bah.
Despite the fact I've been
working with UNIX and C since 1977, I've also worked with C and
C++ on a half dozen operating systems that didn't pretend to be
UNIX. If you want to drivel on about POSIX, take it to a UNIX
group.

The problem is that "POSIX.1++" thing doesn't exist, yet.
Anything related to C++ is, currently, fucking UNtopical
topic in a UNIX group.

regards,
alexander.
 
G

Gianni Mariani

Ron said:
What bearing does that have to do with standard C or C++.

You asked what the man page says. Wether this has any bearing or not is
not part of this discussion and quite irrelevant.

Not only is it nice, it's fucking topical.

No it's not topical. You mis-stated something in an earlier post. All
this thread is about is a correction to your incorrect statement.

Despite the fact I've been
working with UNIX and C since 1977, I've also worked with C and
C++ on a half dozen operating systems that didn't pretend to be
UNIX. If you want to drivel on about POSIX, take it to a UNIX
group.

The NG is about the C++ standard, please post job experience to alt.jobs.
 
R

Ron Natalie

Gianni Mariani said:
You asked what the man page says. Wether this has any bearing or not is
not part of this discussion and quite irrelevant.

The implicication was what did the man page say that had to do with the
statement that strdup isn't standard C or C++. Which is the statement
of mine you were attempting to refute with "it's in the man page."
 
G

Gianni Mariani

Ron said:
The implicication was what did the man page say that had to do with the
statement that strdup isn't standard C or C++. Which is the statement
of mine you were attempting to refute with "it's in the man page."

I wrote it ambiguously ... many apologies. This is what it's meant to say.

....... restated ......
You asked what the man page says and I gave it to you. strdup() being
part of the C++ stanard or not has no bearing on this discussion and is
quite irrelevant to this thread.
........ end .......

I hope it's less ambiguous now.
 
W

White Wolf

Gianni said:
The world is much bigger than the C and C++ standards. Spreading
mis-information about other facets is just plain wrong.

The world is. This newsgroup is not. Suggesting that it is A OK to use
strdup because it exists everywhere where C or C++ exists is wrong.
 
G

Gianni Mariani

White said:
The world is. This newsgroup is not. Suggesting that it is A OK to use
strdup because it exists everywhere where C or C++ exists is wrong.

When did you stop bashing your wife ?
 
G

Gianni Mariani

Buster said:
It's, "Have you stopped beating your wife?".
It only works if it's a yes-no question.

I stand corrected. I'm glad someone knew what I meant :^)
 
W

WW

Buster said:
It's, "Have you stopped beating your wife?".
It only works if it's a yes-no question.

And used heavily by L. Ron Hubbard, the founder of Scientology, to
demonstrate verbal oppression. I note this, because while I have read many
things in my life this question was only mentioned in his works.
 

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,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top