malloc and free

C

Christopher Benson-Manica

Mark Gordon said:
I don't find memmove any more obscure than memcpy, if anything I find it
less obscure because it gives defined results then memcpy invokes UB and
when memcpy does not invoke UB memmove behaves the same.

On the other hand, I imagine memmove requires some amount of extra processing
time in exchange for defined behavior...
 
M

Micah Cowan

E. Robert Tisdale said:
This is bad advice if you need to compile with a C++ compiler:

But in that case, it would not be C code anymore. The advice is
perfectly fine for anyone writing C code.

(Great, not this discussion again...)
 
M

Micah Cowan

E. Robert Tisdale said:
I don't want to discuss C++.
But *real* C programmers can't afford to ignore C++.
They must write C code which can be compiled by C++ compilers
as well as by C compilers.

sez you. There are many "*real* C programmers" on this NG that
sez otherwise. Unless you have a unique definition for "real" (or
"C programmer").
 
D

Dave Vandervies

sez you. There are many "*real* C programmers" on this NG that
sez otherwise. Unless you have a unique definition for "real" (or
"C programmer").

The ones who aren't complex, of course.

It's the simple C programmers that can't ignore C++.


dave
(gratuitiously abusing language since... maybe 1982?)
 
D

Dan Pop

In said:
This is bad advice if you need to compile with a C++ compiler:

What is a C++ compiler? If it is anything behaving like a conforming
standard C compiler, then my advice is excellent. If it is anything else,
it is off-topic in this newsgroup.

Dan
 
D

Dan Pop

In said:
But *real* C programmers can't afford to ignore C++.
They must write C code which can be compiled by C++ compilers
as well as by C compilers.
_____________________
/| /| | |
||__|| | Please do not |
/ O O\__ | feed the |
/ \ | Trolls |
/ \ \|_____________________|
/ _ \ \ ||
/ |\____\ \ ||
/ | | | |\____/ ||
/ \|_|_|/ | _||
/ / \ |____| ||
/ | | | --|
| | | |____ --|
* _ | |_|_|_| | \-/
*-- _--\ _ \ | ||
/ _ \\ | / `'
* / \_ /- | | |
* ___ c_c_c_C/ \C_c_c_c____________

Dan
 
J

John Bode

[snip]
I don't want to discuss C++.
But *real* C programmers can't afford to ignore C++.
They must write C code which can be compiled by C++ compilers
as well as by C compilers.

This is the single most asinine thing I've read all week.

Either you're writing C (in which case you use a C compiler) or C++
(in which case you use a C++ compiler). They're completely different
languages. You wouldn't require someone to write C code that also
compiles as Java, would you? How about C#?

I've worked on a number of projects that had both C and C++
components; we simply used the appropriate compiler for the given
language. I would have thought that was the obvious, logical
solution, rather than deliberately crippling our code to meet the
demands of two different compilers.
 
D

Dave Vandervies

I think you mean irrational C programmers.

That works too, but it doesn't follow quite as nicely from "not complex".
(Unless you can find another way to get from "real" to "irrational"?)


dave
 
M

Mark Gordon

On the other hand, I imagine memmove requires some amount of extra
processing time in exchange for defined behavior...

Yes, it does require extra checks so I still use memcpy when
performance matters *and* I can be certain not to have overlapping
source & destination.
 
T

Thomas Stegen

Dave said:
That works too, but it doesn't follow quite as nicely from "not complex".
(Unless you can find another way to get from "real" to "irrational"?)

I just thought real numbers, complex numbers and irrational numbers.

Maybe that is what you thought as well :)
 
D

Dave Vandervies

[about "real C programmers"]
I just thought real numbers, complex numbers and irrational numbers.

Maybe that is what you thought as well :)

Well, almost. I thought real and complex numbers (the complex numbers
are generally treated as the ones that aren't real, even though they
contain the reals as a subset), and then went from complex to simple
(to undo the "opposite meaning", y'see).

The problem with using irrational there is that irrational numbers
aren't generally considered as "not <something that's not real>", so
using that distinction didn't leave the same opportunity to get in some
mathematically rigorous wordplay at Tisdale's expense.


dave
 
A

Allin Cottrell

E. Robert Tisdale said:
But *real* C programmers can't afford to ignore C++.
They must write C code which can be compiled by C++ compilers
as well as by C compilers.

A perfect occasion for that fine phrase, "arrant nonsense".
 
N

nobody

Dave Vandervies said:
[about "real C programmers"]
I just thought real numbers, complex numbers and irrational numbers.

Maybe that is what you thought as well :)

Well, almost. I thought real and complex numbers (the complex numbers
are generally treated as the ones that aren't real, even though they
contain the reals as a subset), and then went from complex to simple
(to undo the "opposite meaning", y'see).

The problem with using irrational there is that irrational numbers
aren't generally considered as "not <something that's not real>", so
using that distinction didn't leave the same opportunity to get in some
mathematically rigorous wordplay at Tisdale's expense.
What about "surreal" ? Doesn't involve heavy:) math and triple indirection.
Should be good enough even for simple ones (programmers || trolls:)
 

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

Similar Threads

Alternative to Malloc in C 0
malloc 40
malloc and maximum size 56
a fast malloc/free implementation & benchmarks 0
malloc()/free() question 20
malloc() question... 18
using my own malloc() 14
malloc and free? 20

Members online

No members online now.

Forum statistics

Threads
474,302
Messages
2,571,547
Members
48,349
Latest member
JolieEey92
Top