• Welcome to Valhalla Legends Archive.
 

Java: CopyMemory equivalent

Started by Tuberload, April 17, 2003, 12:01 PM

Previous topic - Next topic

Tuberload

Storm: Thank you for the useful info. It was hard to find buried under all the other crap:)

I've been programming in Java about 8 months now and have my Oracle certification and working on getting the sun cert, but there is still a lot to learn.
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

Skywing

Quote from: Camel on April 22, 2003, 12:45 AM
Quote from: St0rm.iD on April 21, 2003, 06:20 PM
I suppose it would go like this:

void copymemory(void* src, void* dest, int len) {
for (int i = 0; i < len; i++) {
*dest = *src;
src++;
dest++;
}


or like this:
#define copymemory memcpy
That could cause annoying syntax errors; memcpy returns a value, while copymemory does not.

Camel

since when was it mandatory to recieve what a function returns?

Skywing

#18
Quote from: Camel on April 22, 2003, 12:03 PM
since when was it mandatory to recieve what a function returns?
It's a good idea when you're replacing a standardized function.  Besides, some C compilers have been known to warn about unchecked return values - perhaps you should use (void)memcpy.

Grok

Skywing you're fighting an uphill battle.  Most people are too lazy to be concerned with the proper way to do things.  Even though learning these techniques will save them and other people much aggravation in the future, the lazy ones only care that their code compiles right now.  Nevermind all the problems that come with being a crappy programmer and distributing crappy code.  If it compiles and runs today, it's all they need or care about, right?

tA-Kane

Quote from: Grok on April 22, 2003, 12:15 PMNevermind all the problems

As the saying goes, "I'll cross that bridge when I get there."
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Banana fanna fo fanna

Or we could just use memcpy and be happy.

Camel


Banana fanna fo fanna