Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

strncpy() vs strncat()

Name: Anonymous 2008-07-05 17:26

Hey /prog/, I've just googled this and it returned a bunch of faggots complaining about buffer overflows.

My question is, as both functions seem to do the same thing, which one would you use?

The man page doesn't leave this clear either, it just says that strcpy zerofills the buffer.

Name: Anonymous 2008-07-08 7:17

>>47
There are some questionable design decisions there, too.

The first is the fact that Man.rape() takes a Woman object and a polymorphic BodyPart object. What happens when the BodyPart belongs to a different Woman?
It would be better for rape() to take a Woman and a constant denoting the BodyPart to be retrieved from the Woman, like so:

anonymous.rape(linda_tarrballs, BodyPart.VAGINA)

I also question the usefulness of being able to pass blood (an uninitialised variable, no less). Perhaps this should be reconsidered.

Next, the Man.dump() method. The first argument looks like it should be a constant, but it isn't in upper case. This is bad practice.
If shit and piss are constants, please change them to SHIT and PISS, and encapsulate them in a relevant class.

Another, quite serious, problem is with the fact that Man has a public command object, which is presumably instantiated in the constructor. That is very bad practice!
Please make this object private, and provide a getter. That would change the line

anonymous.command.make(linda_tarballs, anonymous.location.getKitchen(), pie);
to

anonymous.getCommand().make(linda_tarballs, anonymous.location.getKitchen(), pie);
And again, if pie is a constant, it needs to be in upper case.

My final complaint is not a design flaw so much as an algorithm flaw.
As written, the code allows for anonymous to give a command to a dead linda_tarballs, killing her if she carries it out. This allows for some loopholes and is less than elegant.
Please see if you can't rectify this.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List