[QUOTE=Cathbadh;16395911]Left-shifting cout "Hello, world" times?[/QUOTE]
I think you mean calling ostream.operator<< with the "Hello, world" argument. Nothing unportable about that.
[QUOTE=efeX;16395973]Is your computer by any chance, a pentium 2 or lower?[/QUOTE]
I know it's fun to laugh at people's computers instead of being actually useful, but in all reality I'm sure a Pentium 2 would manage the install just fine. It's most likely a software bug.
[QUOTE=Cathbadh;16395911]Left-shifting cout "Hello, world" times? This isn't portable assembly.[/QUOTE]
Feeding "Hello, world" to std::cout is more like it. Operator overloading isn't some sort of intentional confusion - it's meant for encapsulation and making things easier to read and write.
Same thing with boost::path("data") / "media" / "textures".
OH NO UR DIVIDING A PATH BY A STRING WTF AND THEN UR DIVIDING AGAIN U SPOILED C++ BRAT
[QUOTE=nullsquared;16396532]Feeding "Hello, world" to std::cout is more like it. Operator overloading isn't some sort of intentional confusion - it's meant for encapsulation and making things easier to read and write.
Same thing with boost::path("data") / "media" / "textures".
OH NO UR DIVIDING A PATH BY A STRING WTF AND THEN UR DIVIDING AGAIN U SPOILED C++ BRAT[/QUOTE]
Dear [i]god[/i], he's using a forward slash but [b]he isn't dividing
all is wrong with the world[/b]
[QUOTE]Is your computer by any chance, a pentium 2 or lower? [/QUOTE]
Pentium 4
[QUOTE=gparent;16396373]I think you mean calling ostream.operator<< with the "Hello, world" argument. Nothing unportable about that.[/QUOTE]
I don't think he's saying that C++ isn't portable, just that it is less clear how a C++ compiler will translate code into machine instructions. That's why it seems like C is just a portable [I]assembly[/I], while C++ does not.
I'm sure you could dig through all the syntactic sugar and determine what a C++ operator/function/template is [I]actually doing[/I], but in C these things are always immediately apparent.
[QUOTE=ROBO_DONUT;16397320]I don't think he's saying that C++ isn't portable, just that it is less clear how a C++ compiler will translate code into machine instructions.[/QUOTE]
Then he should've used a more relevant example. Choosing operator<< implies that operator overloading is somehow confusing, but it's just an overload. It's just as easy to look what operator<< does than it is to look at what printf() does.
[quote]I'm sure you could dig through all the syntactic sugar and determine what a C++ operator/function/template is actually doing, but in C these things are always immediately apparent. [/quote]
Templates I'll give you that, but it's always immediately apparent what any operator is doing in C++. It's just a function like anything else.
[QUOTE=gparent;16397682]Then he should've used a more relevant example. Choosing operator<< implies that operator overloading is somehow confusing, but it's just an overload. It's just as easy to look what operator<< does than it is to look at what printf() does.[/QUOTE]
Overloading has its own idiosyncrasies.
[QUOTE=gparent;16397682]Templates I'll give you that, but it's always immediately apparent what any operator is doing in C++. It's just a function like anything else.[/QUOTE]
Depends, I hate it when people abuse operator overloading. Eg using * and ^ as cross and dot products for a vector class. IMO they are far better suited for simple dot() and cross() functions because the operators don't mean shit all.
But if the operators are obvious then I <3 overloading.
[QUOTE=r4nk_;16397887]Depends, I hate it when people abuse operator overloading. Eg using * and ^ as cross and dot products for a vector class. IMO they are far better suited for simple dot() and cross() functions because the operators don't mean shit all.
But if the operators are obvious then I <3 overloading.[/QUOTE]
What's not obvious about VectorA*VectorB giving the dot product?
I think operator overloading is a godsend and should be used wherever possible.
[QUOTE=Sporbie;16402162]What's not obvious about VectorA*VectorB giving the dot product?
I think operator overloading is a godsend and should be used wherever possible.[/QUOTE]
How do you know V1 * V2 is dot and not cross?
You dont.. you'd have to check.. because the symbol * means fuck all when it comes between two vectors.
* means what it means with anything else: multiply.
v1 * v2 = v1.x * v2.x, v1.y * v2.y, v1.z * v2.z
[QUOTE=nullsquared;16403650]* means what it means with anything else: multiply.
v1 * v2 = v1.x * v2.x, v1.y * v2.y, v1.z * v2.z[/QUOTE]
Neither product does that to vectors in mathematics.
It's best just to leave the "*" operator undefined and define dot() and cross() functions/methods to avoid any ambiguity.
If anything, leave the "*" operator for scalar multiplication exclusively.
[QUOTE=ROBO_DONUT;16403789]Neither product does that to vectors in mathematics.
It's best just to leave the "*" operator undefined and define dot() and cross() functions/methods to avoid any ambiguity.
If anything, leave the "*" operator for scalar multiplication exclusively.[/QUOTE]
I didn't say "product", I said "multiply". Have you ever written a shader? float3(a, b, c) * float3(x, y, z) gives you float3(a * x, b * y, c * z). It's very useful for masking, scaling, etc.
[QUOTE=raccoon12;16379079]Feel free to swear... we really don't care.
removed advice because I'm dumb apparently
edit:
also, "the shit" means it's the best[/QUOTE]
And that my friend, is why you are rated dumb.
[QUOTE=r4nk_;16403561]How do you know V1 * V2 is dot and not cross?
You dont.. you'd have to check.. because the symbol * means fuck all when it comes between two vectors.[/QUOTE]
Well usually when I saw some Vector formulas, they used * for dot product and x for cross product. The teacher taught us that way in school too, so it's kind of a standard.
[QUOTE=Sporbie;16414319]Well usually when I saw some Vector formulas, they used * for dot product and x for cross product. The teacher taught us that way in school too, so it's kind of a standard.[/QUOTE]
They use a dot for dot product. An asterisk is not a dot.
Wow why is everyone here such a smartass. The asterisk is obviously similar to the dot, and it's more convenient to write than a dot (I don't mean a ' . '), if there even is such a unicode character. Why don't you write a dot when multiplying integers?
Because it's fucking confusing.
As you said so yourself, an asterisk is similar to a dot (for dot product), but is also similar to the X, which we use for cross-product (and we replace the X by a * when multiplying integers).
The asterisk has nothing to do with dot or cross product. Just don't use it for either of those.
[QUOTE=gparent;16420017](and we replace the X by a * when multiplying integers).
[/QUOTE]
Really? We in school use the dot for multiplying numbers not the x. Maybe it's different in your country. I thought the dot was a standard for multiplying numbers.
Depends on the country.
"The middle dot is standard in the United States, the United Kingdom, and other countries where the period is used as a decimal point. In some countries that use a comma as a decimal point (such as in Greece), the period is used for multiplication instead." [url=http://en.wikipedia.org/wiki/Multiplication#Notation_and_terminology][1][/url]
Well in Canada we mostly use ×, which is even titled "Multiplication Sign" in the character map.
Using a comma as a decimal point is fucking stupid, I mean:
1,300.22 = one thousand,three hundred [b]POINT[/b] 22 - A [b]clear[/b] divider, fuck.
1.300,22 = one thousand three hundred[b],[/b] 22 - a comma? what? does the number continue? OH WAIT BUT IT WENT INTO DECIMALS WITH THAT DOT OH NO WHAT NOW
[QUOTE=bigdoggie;16421676]Using a comma as a decimal point is fucking stupid, I mean:
1,300.22 = one thousand,three hundred [b]POINT[/b] 22 - A [b]clear[/b] divider, fuck.
1.300,22 = one thousand three hundred[b],[/b] 22 - a comma? what? does the number continue? OH WAIT BUT IT WENT INTO DECIMALS WITH THAT DOT OH NO WHAT NOW[/QUOTE]
What? That's stupid! You are just transposing your own experience how your marking system works, and using that as a reason. It is a shitty-ass reason.
[QUOTE=bigdoggie;16421676]Using a comma as a decimal point is fucking stupid, I mean:
1,300.22 = one thousand,three hundred [b]POINT[/b] 22 - A [b]clear[/b] divider, fuck.
1.300,22 = one thousand three hundred[b],[/b] 22 - a comma? what? does the number continue? OH WAIT BUT IT WENT INTO DECIMALS WITH THAT DOT OH NO WHAT NOW[/QUOTE]
Congratulations for showing us your ignorance regarding locales.
It's not 1.300,22. It's "1 300,22". Nothing confusing about it.
"330 382 012,22" - What's not obvious about that?
[QUOTE=nullsquared;16381455]Linux isn't Windows. Get over it.[/QUOTE]
That's a good thing on Linux' part.
[QUOTE=PvtCupcakes;16379184]Depends on what you want to do.
Linus prefers C over C++ because of what he does. C++ isn't as good as C for creating kernels and drivers and filesystems and the like.
For everything else, both are fine.[/QUOTE]
Why would C be better for creating kernels and stuff?
[QUOTE=thf;16438097]Why would C be better for creating kernels and stuff?[/QUOTE]
Because I'm... too... lazy... to... write... C++... runtime... su-zzz.
Well, first off, assume you don't get much in the way of built-in functions anyway, the standard library, static objects or global objects without hacking up code to support it, I suppose. (there's a section in The C++ Programming Language about the features of C++ that require a runtime)
Wouldn't C++'s automagic memory allocation and corner cases (or just "overhead that comes with features") be a bitch, though? I'd suppose what'd you get could be easily rewritten into C anyway without having to futz over everything...
C is more portable, smaller, simpler, faster and less bloated than C++. It plays nice with other languages and the compiler isn't insane ( There's a reason compilers are all over the place with C++ and it's not because they're all made by idiots ). C++ has its uses, but they're not in the low level world where predictability and control are much more important than classes and template meta-programming.
Performance matters in a kernel. If the kernel is slow, everything that runs on top of it will also be slow. And certain features of C++ wouldn't work in a kernel since it needs to run through a runtime. And with a kernel you don't have nice things like runtimes because the runtime needs a kernel to run on.
this topic has pretty much turned into c vs c++ in kernels.
Sorry, you need to Log In to post a reply to this thread.