I considered doing that but it just seems sloppy. It looks like it'd work, but somewhere you'll have to write a winding, thick forest of if or switch/case statements. And excessive branching can really suck balls on some processors (lol Pentium 4 lol).
Although that's probably about as "neat" as you can get in C++, I guess... :/
I thought P4's crappy branching was one of the reasons the "branch prediction" technology in Intel's new processors kicks so much ass.
Name:
Anonymous2006-11-10 19:16
>>12
Netburst P4's have this "feature" due to the xbox-hueg long pipeline where one branch prediction miss costs you about twenty five cycles. That's on a Prescott, mind, it's like eighteen on Northwoods and Willamettes.
Unsurprisingly then the main speed boost from HyperThreading comes from being able to run the other thread while one suffers from a branch misprediction. Goodbye mainstream code performance.
NetBurst was pretty cool though if you first spent about a week coming up with an optimized routine to do something that you'd like. Kind of like an extremely well hidden DSP mode, only you need to do 128-bit wide integer SIMD stuff and no branching to get at it.
>>29
What the fuck. Gento went that way ------> (out of /prog), now GTFO.
Name:
Anonymous2007-07-17 17:28 ID:uU2y6e+u
>>29
The first statement would get compiled to something like:
mov eax, [a]
sub eax, 2
test eax, eax
jne cond_false
The second gets compiled to:
cmp [a], 2
jne cond_false
Tell me, which one do you think is more efficient?
Name:
Anonymous2007-07-17 17:29 ID:uU2y6e+u
Additionally, the first of the statements lends itselfs to branch mispredictions, potentially making it slower for the CPU to pipeline the correct instructions.
>>27
You're doing it wrong char *foo = malloc(sizeof(*foo) * n);
Also, YOU DON'T NEED TO MULTIPLY IT WITH sizeof(char), because that is guaranteed to be 1.
A char represents a byte.
Name:
Anonymous2007-07-18 4:42 ID:yz7Aoeaz
>>3
According to the Standard, a[b] is the same as b[a] which both are just syntactic sugar for *(a + b)
So: a[10] is *(a + 10) and 10[a] is *(10 + a) which are both the same thing.
>>37
If I remember the standard correctly, a character is AT LEAST a byte, but is in fact up to the implementation what the actual size is (depending on architecture and whatnot). Of course, it's been a while since I've looked at the standard, so I may be wrong.
>>25
Alternative, sure, but not the same. The (char[52]){0,} trick, i believe, would be placed on the stack, the new char[52] on the heap. Minor difference.
>>42,43
Ah, I stand corrected. I think what the standard actually says, then, is that a char is at least 8 bits. Thanks for the clarification ;-)
Name:
Anonymous2007-07-18 6:48 ID:7uXIxOPr
But the standard is a piece of shit. Anything with a name resembling a character should be at fucking least 21 bits, and the ONLY character set which it should ever support should be ISO/10646 UCS. Then strings should be abstracted so you don't poke your nose (overriding [] as necessary) and they should use an implementation-defined Unicode Transformation Format out of the three possible UTF-8, UTF-16 and UTF-32, with full Unicode semantics as defined in Unicode 5.0 and no character set/encoding conversions AT FUCKING ALL. Then, when you want to read/write strings from/to a file/terminale/etc., you either use the Unicode Transformation Format used by the stream (one of UTF-8, UTF-16, or UTF-32, specified when creating it), or you can call the function __WARNING__SHIT_COMING_convert_character_set_yes_I_really_want_to_do_this_yes_I_know_I_shouldnt(str, other_legacy_goddamned_piece_of_shit_charset, FOR_REAL | YES_I_AM_A_MORON_FOR_NOT_USING_UNICODE). Of course, for binary files and sockets, you should use byte arrays, whose type should be byte or signed byte, and you'd have a function similar to the one I described for byte array to string conversion.
That's how things should be done. Anything that's not Unicode should be filtered through kill_this_shit(WITH_FIRE).
>>45 An object declared as type char is large enough to store any member of the basic execution character set.
a char must be at least 7 bits in c99, since you need at least 7 bits to represent all the characters that must be included in the basic execution character set.
regarding the size of a byte, wikipedia says: historically, bytes have ranged from five to twelve bits. [citation needed]
>>39
Nope. Section A7.4.8 (page 204) of the C Programming Language defines sizeof(char) to be 1.
Name:
C FAG2007-07-18 17:11 ID:ROniVmzU
>>1
Oh wow lol. *(a < b ? a : b < c ? b : c) = val(); works for me. Srsly, C++ has seriously gone overboard on the syntactic sugar. It's making code much more difficult to understand.
Name:
C FAG2007-07-18 17:13 ID:ROniVmzU
... of course that compares pointers. what the C++ version with the references does is actually *(*a < *b ? a : *b < *c ? b : c) = val(); which is parsed quite easily given a syntax-highlighting editor.
Name:
Anonymous2007-07-18 18:25 ID:+KT41DJE
An object declared as type char is large enough to store any member of the basic execution character set. If a member of the basic execution character set is stored in a char object, its value is guaranteed to be positive. If any other character is stored in a char object, the resulting value is implementation-defined but shall be within the range of values that can be represented in that type.
ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO. ASCII IS ALL YOU NEED OTHERWISE YOU ARE A WEEABOO.
Name:
Anonymous2007-07-19 5:21 ID:vkspcyb4
>>70
Amerifag thinks no other languages/currencies/symbols/etc. exist. Not a big problem though, Amerifag will soon die of heart attack due to eating at Amerifag "restaurants".
>>73
Europe is so expensive, we can't afford food. Blame Socialism.
Name:
Anonymous2007-07-20 4:37 ID:7wGDr5GE
>>73
Lol? Amerifags are the ones who are (in)famous for their obesity from eating American-sized shit at American shit dumps they call "restaurants". Everything has to be big and ugly: cars, food, people...
Shit Some of my contract you can read more abotu this practice at transforming equations Like doing algebra except with functions So it must be said by him and as you can see he gave up on the spot nonsense no one know a way to his toy languages and their advocates.