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: Lost 2008-07-07 19:57

>>40
You Shirou'd me.

Name: Anonymous 2008-07-07 20:01

>>40
I'd fuck her tits if you catch my drift.

Name: Anonymous 2008-07-07 20:14


Woman linda_tarballs = new Woman();
Man anonymous = new Man();

if (linda_tarballs.getVirginity()){
  anonymous.rape(linda_tarballs, linda_tarballs.getVagina());
  if (linda_tarballs.isbleeding(vagina)){
    anonymous.rape(linda_tarballs, linda_tarballs.getAnus(), blood);
  else
    anonymous.kill(linda_tarballs);
}
else
  while(anonymous.hasCum()){
    anonymous.rape(linda_tarballs, linda_tarballs.getAnus());
}
  anonymous.dump(shit, linda_tarballs.getMouth());
  anonymous.dump(piss, linda_tarballs.getVagina());
  anonymous.command.make(linda_tarballs, anonymous.location.getKitchen(), pie);
  if (anonymous.inventory.getItemcount(pie) >= 1)
    anonymous.kill(linda_tarballs);

Name: Anonymous 2008-07-07 20:16

>>43
The Sussman approves the content but not the form.

Name: Anonymous 2008-07-07 20:19

>>44
Sorry, forgot the {} for the last else.

Name: Anonymous 2008-07-07 20:42

>>26
Dye in a faerie

Name: Anonymous 2008-07-08 6:58

>>43
I've taken the liberty of fixing your indentation and highlighting a syntax error:

Woman linda_tarballs = new Woman();
Man anonymous = new Man();

if (linda_tarballs.getVirginity()) {
    anonymous.rape(linda_tarballs, linda_tarballs.getVagina());

    if (linda_tarballs.isbleeding(vagina))
{
        anonymous.rape(linda_tarballs, linda_tarballs.getAnus(), blood);
    else
        anonymous.kill(linda_tarballs);

} else
    while(anonymous.hasCum()){
       anonymous.rape(linda_tarballs, linda_tarballs.getAnus());
    }

anonymous.dump(shit, linda_tarballs.getMouth());
anonymous.dump(piss, linda_tarballs.getVagina());
anonymous.command.make(linda_tarballs, anonymous.location.getKitchen(), pie);

if (anonymous.inventory.getItemcount(pie) >= 1)
    anonymous.kill(linda_tarballs);


Please ensure your code compiles before submitting it to /prog/ in the future.

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.

Name: Anonymous 2008-07-08 12:46

>>48
It would be better for rape() to take a Woman and a constant denoting the BodyPart to be retrieved from the Woman, like so:

>Please make this object private, and provide a getter. That would change the line

Gotcha. Good suggestion.

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

Name: Anonymous 2008-07-08 12:55

>>49
So blood is an object of type Lubricant? Be sure to declare and initialise the variable!

Name: Anonymous 2008-07-08 13:58


if (linda_tarballs.getVirginity()) {
    anonymous.rape(linda_tarballs, linda_tarballs.getVagina());


Why would anynomous rape linda *after* virginity GET?

Also you should try to avoid mixing camelCase and lower_case

Name: Anonymous 2008-07-08 14:04

>>51
getVirginity() just returns a boolean; it doesn't actually change anything (it doesn't have ``side effects''). By convention, getters don't have side effects.

Name: Anonymous 2008-07-08 14:10

Name: Anonymous 2008-07-08 14:16

>>53
Syntactic sugar for getters and setters? Writing them out normally is only one word and a set of parentheses longer.

Name: Anonymous 2008-07-08 14:24

>>54
Regular setters are more powerful, too, since they can have more than one argument.

Name: Anonymous 2008-07-08 14:48

>>54-55
Syntactic sugar isn't always a bad thing. You can also specify properties like this:

public class Error {
  public int LineNumber { get; protected set; }
}

which automatically generates getters and setters, then replace them with actual code later if needed. Reducing boring typing and boilerplate is nice.

Properties and methods also behave differently with respect to reflection, thus making it easier to build GUI tools such as DataGridView and PropertyGrid (granted, you could do this by marking getters and setters with attributes [does Java have those?]).

Name: Anonymous 2008-07-08 16:03

>>56
does Java have those?
I'm not sure what you mean by ``attributes''. Example?

Name: Anonymous 2008-07-08 16:05

>>56
public int LineNumber { get; protected set; }
public

Now why would you need a getters and setters?

Name: Anonymous 2008-07-08 16:08

>>58
For the protected setter?

Name: Anonymous 2008-07-08 16:17

>>57
In Java, they're ``annotations''

Name: Anonymous 2008-07-08 16:18

>>56
Indeed. Probably the worst thing about Java is its unnecessary verbosity.

Name: Anonymous 2008-07-08 18:47

>>58
That reminds me, does anyone know if changing a public field into a property affects binary compability?

Name: Anonymous 2008-07-08 20:02

>>62
It most likely does, since properties are syntactic sugar for methods, and fields are... fields.

Name: Anonymous 2008-07-08 21:28

>>63
Well in .NET it's all JIT'ed anyway, so they could have held off the decision to allow for magical inlining deliciousness. It appears that they don't, though.

Name: Anonymous 2008-07-08 22:21

>>64
The JIT is disappointing in many places. Around .NET 2.0-time, it didn't even inline any methods which had value types as parameters, even if they were under the 32-byte limit. I'm not sure if this defect still exists.

Name: Anonymous 2009-03-06 12:07


Ghetto random number generator is very large   yet finite N   so all algorithms   we CAN run   all the examples   given in K   k putchar k.

Name: Anonymous 2010-11-14 5:55

Name: Anonymous 2011-02-04 18:03

Name: Sgt.Kabukimanꁽ렝 2012-05-24 10:07

All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy

Name: bampu pantsu 2012-05-29 4:04

bampu pantsu

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