This should answer you: http://www.churchillobjects.com/c/11027b.html
Basically it seems that because as in Java everything is a reference, mutable strings would be a nightmare with containers.
Silex
@Silex
Best posts made by Silex
Latest posts made by Silex
-
RE: "Why" + " is" + " " + "this" + " " + "ba" + "d?"
-
RE: Scope? No scope!
@Ozru said:
You can dislike it all you want, but because variables aren't explicitly declared, there's no way to have the assignment in the braces differentiate between modifying an existing variable and creating a new one. Whichever choice you make will tick some people off. The choice they made is the one that allows more functionality, even if it ticks you off that the implicit declaration is outside the brace scope instead of inside it.
Good point.
-
RE: Scope? No scope!
@dhromed said:
However, the C family of languages (bitchslap me if I'm wrong) tend to create a new sub-scope for each and every {} block, including ifs and loops, which is likely what Silex is used to.
Yes, that's what I'm used to. It's the same in Java, C#, C/C++... and I think it's what is sane. Of course for a script language I can understand they allow it, still I dislike it.
-
RE: Const_cast? What's that?
<font face="Verdana" size="2">@ammoQ said:
wouldn't the compiler complain about the cast?
No. At least not on my compiler.
I guess some compilers might issue a warning but usually when you do a C cast you're just doing a "shut the compiler </font><font face="Verdana" size="2">up</font><font face="Verdana" size="2">" strategy.
C++ casts are prefered to C casts because they do only one concept, when (TYPE) can have 3 differents meaning : remove the constness / convert to type / make x be seen as y.
</font> -
RE: Scope? No scope!
<font face="Verdana" size="2">It's because you must declare $bloop as global :
</font><font face="Verdana" size="2">$bloop = 'heh';
<font face="Verdana" size="2"></font>
<font face="Verdana" size="2">function foo()</font>
<font face="Verdana" size="2">{</font>
<font face="Verdana" size="2"> global $bloop;</font>
<font face="Verdana" size="2"> $bloop .= 'gnork';</font>
<font face="Verdana" size="2">}</font>
<font face="Verdana" size="2">foo();</font>
<font face="Verdana" size="2">echo $bloop;</font>
Yes, that's fucked up. But the worse about php scope is actually code like this :
if(true)
{
$bla = 34;
}
echo $bla;
</font> -
RE: Const_cast? What's that?
<font face="Verdana" size="2">lol what an inneficient way :)
The WTF is that the guy is good enough to know about stringstream but couldn't write :
</font><font face="Verdana" size="2">void* const_ptr_too_normal_ptr(const void* ptr)
{
return (void*) ptr;
}
Not knowing about </font><font face="Verdana" size="2">const_cast<void*>(ptr) is half-understandable, but not understanding that </font><font face="Verdana" size="2">his return (void*)(temp) is what is actually removing the const is fucked up.</font><font face="Verdana" size="2"></font> -
RE: Inexplicable problem in a very simple piece of code
If you really need precision you can use a bignum library like GMP (http://www.swox.com/gmp)