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

Pages: 1-4041-

this is why bugs exist

Name: Anonymous 2006-09-11 16:24

The reason why bugs exist in software amounts to one word (well technically two):

BRAINFARTS

look at this... I didnt catch this for a whole hour in my code:

Vector3D Vector3D::add(Vector3D vect)
{
    Vector3D v;
    v.x = x * vect.x;
    v.y = y * vect.y;
    v.z = z * vect.z;

    return v;
}


;_;

I'm not even drunk or high.  Why the shit did I do this?  i must be stupid

sigh

Name: Anonymous 2006-09-11 16:47

[aa]                   ∧_∧   / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
            ( ´∀`) <  Emma Nilsdotter is really the voice of britney spears!
          /    |    \________
         /       .|     
         / "⌒ヽ |.イ |
     __ |   .ノ | || |__
    .    ノく__つ∪∪   \
     _((_________\
      ̄ ̄ヽつ ̄ ̄ ̄ ̄ ̄ ̄ | | ̄

Name: Anonymous 2006-09-11 16:53

>>1
and whats the deal with not overloading operator+, and not passing vect by reference?

Name: Anonymous 2006-09-11 17:08

>>3

In time.  I don't overload any operators until I write these as, well, named functions first, and test their correctness.

In before someone whines about my workflow.

Name: Anonymous 2006-09-11 17:24

My C++ is getting rusty, but why does the function take a struct instead of a const reference?

Name: Anonymous 2006-09-11 18:31

>>4
Your workflow is retarded.  Debugging is better.

In after someone whines about your workflow.

Name: Anonymous 2006-09-11 19:54

>>6

In after someone confuses "in during" with an "in after", and in during someone points out >>6 confused "in during" with an "in after", and in before, after, and during this thread devolves into usual 4channery.

Name: Anonymous 2006-09-11 19:55

>>5

It's not a struct, Vector3D is a class.  I'm not an anal Best Practices engineer about "proper" OOP style so x, y, and z are public.

Name: Anonymous 2006-09-11 20:33

so a class in c++ is the same as a struct except a class is a reference to a struct, right?

Name: Anonymous 2006-09-11 21:23

No. Classes can contain code and inherit/be inherited.

Implementation-wise, they classes contain pointers to virtual tables, and objects are something like structs.

Name: Anonymous 2006-09-11 22:43

So what's the bug in this?

Name: Anonymous 2006-09-11 22:57

>>11

It was meant to be a vector addition function, but ... notice the multiplications.  I did this right after I wrote the multiplication function and I guess my mind was thinking about round bouncing boobs and big giant dongs so I got distracted.

Name: Anonymous 2006-09-11 23:34

>>8
Wow, you are a shitty programmer.

Name: Anonymous 2006-09-11 23:49

>>13

i guess so is john carmack.  from idlib:

class idVec2 {
public:
    float            x;
    float            y;

                    idVec2( void );
                    explicit idVec2( const float x, const float y );

... etc etc

There's no need to be that fucking anal for mathematical objects, unless you're a professor who grades his students but himself hasn't done any programming since 1978.

Name: Anonymous 2006-09-11 23:58

I agree with >>14, especially when dealing with a language that has properties. Of course, C++ doesn't support that as part of spec yet. Booo.

In the case of Vector3D, all it's for is a wrapper to simplify mathematical transformations on the (well defined and understood) data contained within, so I don't see what's wrong with tossing getters/setters. Seriously, why would you need to hide x, y, z?

That's not to say getters and setters don't have their place.

Name: Anonymous 2006-09-12 7:25

>>15
Not to mention it is a bloody freaking vector. There is the expectation that you'll be able to dump whatever numbers in there and freely manipulate them; there is no need to "hide" anything.

Name: Anonymous 2006-09-12 7:53

>>13
Wow, you are a faggot. With your best practices (TM), people like you make software ugly to use and maintain.

Anyways, C++ is suboptimal for this kind of thing. In Python, you can declare properties and use them naturally, while, if necessary, they are actually get/set/del functions you define. The possibility of changing implementation with the syntactic elegance and conceptual simplicity of properties.

Name: Anonymous 2006-09-12 8:38

>>14
>>13 was (if not, I am now) pointing out that >>8 didn't understand why he would pass a const reference instead of a class.  Thus, >>8 is a shitty programmer.

Name: Anonymous 2006-09-12 8:45

The possibility of changing implementation with the syntactic elegance and conceptual simplicity of properties.
This is what makes properties so awesome.

At first I thought the "Pythonic" (god I hate that word) way of directly accessing attributes was retarded, until I realized the effect that properties have.

Every OO language should have them. Of course C++ doesn't, but there's always D.

Name: Anonymous 2006-09-12 12:59

what the fuck are properties?

Name: Anonymous 2006-09-12 14:54

>>20
They're basically getters and setters that work with equalities.  So instead of

object.setpoop(5)
or
x = object.getpoop()

A propery, like in C#, would be:
object.Poop = 5
or
x = object.Poop

And properties, even though they're accessed like equalities, are essentially functions just like getpoop() and setpoop() -- they're just syntactically nicer.

Name: Anonymous 2006-09-12 15:02

>>21
o okay. Anyway, I think getters and setters and properties are stupid for a simple 3D vectors. It's just 3 fricking numbers for god sake. You don't need to inherit them or dynamically allocate stuff inside of it. Just use a struct and be done with it. Overloaded arithmetic would go well with it too. That's pretty much it with 3D vectors.

Name: Anonymous 2006-09-12 18:22

properties are stupid for a simple 3D vectors.
Yeah, in this case they are. The reason why properties are useful is because if you start by accessing public variables directly, you can later change the class implementation without breaking all the code that uses that class.

For example (purely hypothetically!), one day you may decide that using a float for x, y, z isn't good enough, and want to replace it with a complex number implementation. Using properties this is simple, without having to fix all external references to x, y, z.

Name: Anonymous 2006-09-12 21:41

>>23
I agree. Compared to properties, getters and setters seem to be stupid.

Name: Anonymous 2006-09-12 22:40

How do you declare properties?

Do you define a get/set pair for a member variable and Python's smart enough to know figure out A.X is A.getX()?

Name: Anonymous 2006-09-12 23:54

For read-only, you can do a shortcut using decorators. It goes like this:
class Example:
    def __init__(self):
        self._text = "foo bar"
    @property
    def value(self):
        return self._text
If you want to be able to both read and write:
class Example:
    def __init__(self):
        self._text = "foo bar"

    def _getValue(self):
        return self._text
    def _setValue(self, value):
        self._text = value
    value = property(_getValue, _setValue)

Name: Anonymous 2006-09-13 16:18

>>26
__wtf__ is this shit?

Name: Anonymous 2006-09-13 17:06

>>27
It's a better language than whatever you use

Name: Anonymous 2006-09-13 18:13

>>28
PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC PYTHONIC

Name: Anonymous 2006-09-13 21:46

GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT GAY SHIT

Name: Anonymous 2006-09-14 5:58

         ∧_∧   ┌────────────
       ◯( ´∀` )◯ < As for me, it's Pythonic! Let me feed you with a __spoon__!
        \    /  └────────────
       _/ __ \_
      (_/   \_)
           lll

Name: Anonymous 2006-09-14 11:38 (sage)

         ∧_∧   ┌────────────
       ◯( ´∀` )◯ < I am __pythonic__-chan!
        \    /  └────────────
       _/ __ \_
      (_/   \_)
           lll

Name: Anonymous 2006-09-14 19:20 (sage)

         ∧_∧   ┌────────────
       ◯( ´∀` )◯ < lol __pythonic__
        \    /  └────────────
       _/ __ \_
      (_/   \_)
           lll

Name: Anonymous 2006-09-15 2:56

        ∧_∧   ┌────────────
       ◯( ´∀` )◯ < lol __pythonic__
        \    /  └────────────
       _/ __ \_
      (_/   \_)
           lll <- this is my penis

Name: Anonymous 2006-09-15 13:14

None of you can actually program, right?

That's why you keep dumping your anally retentive syntax and language wars here, because you just heard in class that your way is TEH WAY TO DO IT amirite?

Name: Anonymous 2006-09-15 14:06

>>35
pretty much.

Name: Anonymous 2006-09-15 19:08

>>35
DO YOUR OWN HOMEWORK FAGGOT

Name: Anonymous 2006-09-16 15:34

>>37
Get AIDS and die.

Name: Anonymous 2006-09-18 10:34

>>8

Then why use OOP languages at all? You struct loving bastard.

Name: Anonymous 2006-09-18 11:01

>>39
gb2/sun.com

Name: Anonymous 2010-08-10 19:07

necropost

Name: Anonymous 2010-08-11 4:37

>>42
Fuck you, ``       ''.

Name: Anonymous 2010-08-11 6:30

Mediocre thread.

Name: ​​​​​​​​​​ 2010-10-23 19:46

Name: Anonymous 2011-02-04 15:32

Name: Sgt.Kabu䵬鼵kiman㮑㮺 2012-05-28 20:00

Bringing /prog/ back to its people
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

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