something like g++ -Wall project.cpp
c++ help? - Page 3
Blogs > tossinYoSalad |
PaiNt)
United States38 Posts
something like g++ -Wall project.cpp | ||
tossinYoSalad
United States215 Posts
On October 14 2009 16:14 Slithe wrote: The issue with c++ is that there are a lot of nuances to it that gives it a steeper learning curve. As a result, one is a lot more error-prone when writing c++ code. Regarding the assignment inside a conditional, here's random example code where it might be used: char[] str = "Hello TeamLiquid!" char c; for (int i = 0; (c=str[i]) != 0; i++) { printf("Letter: %c", c); } From a stylistic point of view, I don't think it's usually a particularly good idea, but it would be inconsistent to treat the assignment differently just because it was placed inside a conditional statement. Huh that does make a lot of sense actually lol. I'm just used to java where if the if() statement doesn't resolve to a boolean it doesn't compile. C++ is nice and I like the fact that you have more freedom and it compiles directly to machine language and all, but some things about it just frustrate me. Like the fact that you can't declare an array without having a definite size for it ( yes I tried using extern.) Also thanks a ton to everyone who helped me out. You guys rock . oh and Sonovbob didnt catch the error. Sorry aethereal. He found another error though . | ||
ph33r
Canada58 Posts
On October 15 2009 04:10 tossinYoSalad wrote: Huh that does make a lot of sense actually lol. I'm just used to java where if the if() statement doesn't resolve to a boolean it doesn't compile. C++ is nice and I like the fact that you have more freedom and it compiles directly to machine language and all, but some things about it just frustrate me. Like the fact that you can't declare an array without having a definite size for it ( yes I tried using extern.) Also thanks a ton to everyone who helped me out. You guys rock . oh and Sonovbob didnt catch the error. Sorry aethereal. He found another error though . You can use vectors if you want to implement dynamic arrays, or use pointers, like: int *ptr; ptr = new int[5]; ... int *ptr2 = new int[10]; for ( ... ) ptr2[i] = ptr[i]; delete[] ptr; | ||
b3h47pte
United States1317 Posts
On October 14 2009 15:43 EtherealDeath wrote: nah C++ is pretty easy, although nowadays I suggest you learn Java or C# EDIT: Although, if I recall correctly C# can execute up to 40 times slower than C++, and the JVM means Java is slower as well (but you would learn the details yourself in a Java course). Of course, efficiency usually won't matter too much... though I think most games are not made with Java/C# (WoW for instance is written in C++), but you would use a lot of C# and Java in other programming jobs. if you want to do game programming i believe you should learn C++ but you can also do some C#/XNA stuff if you're more inclined to do so that way.. However I do believe more software jobs (outside of games) use C#/Java for newer stuff. At the place where i interned at, their old utilities were written in VB6 with the newer ones using C#. | ||
tossinYoSalad
United States215 Posts
On October 15 2009 05:08 ph33r wrote: You can use vectors if you want to implement dynamic arrays, or use pointers, like: int *ptr; ptr = new int[5]; ... int *ptr2 = new int[10]; for ( ... ) ptr2[i] = ptr[i]; delete[] ptr; Yeah I could have done that but it was unnecessary as it just required a two-dim array of fixed size. It created a problem because I wanted to have all references to the size of the array come from a single method, and you cannot do this upon creating the array (apparently). It wasn't a huge issue but it just irked me because I couldn't follow basic good programming principles. | ||
| ||