I'll stick with the static solution since it is a little cleaner. Thanks :)
Type: Posts; User: philvaira
I'll stick with the static solution since it is a little cleaner. Thanks :)
Good idea. I changed my code to the following. If I'm using malloc, I'd have to call free though. I'd like to do it within the function so I'm not calling free() outside of it.
Another solution...
Agreed. It's a bunch of kids and following the leader really. I found myself more productive when I stopped going to that site.
Edit:
I would recommend the IGDA forums: http://www.igda.org/
...
I have an interesting problem here. The function returns the first cell of a local array, so I am getting this: returning address of local variable or temporary. How can I return a new string without...
The short answer is Microsoft recommends using DirectX on their operating system, so the majority of professional Windows developers use DirectX. In doing so, they have the support of Microsoft and...
Hello,
Besides ID Software, is there any free source code that game companies have given out? I'm interested in viewing them. The only ones I could find are written in 1992-1997 mostly in the DOS...
Hello,
My name is Phil and I am a recovering bias addict.
OpenGL and Direct3D do about the same things. They call the same graphics hardware. OpenGL was easier in the past due to its...
Yes, the second assumption is what I meant.
I'm debating whether to do this or just keep a static array. I think malloc/free is the best way to go so I'm not wasting memory and I can resize if...
I was afraid of that. Unfortunately that means having something like String_Release(&str); at the end of every function that initializes a new string. Is there any way around it?
I could do this...
I'm curious if this can work somehow? My goal would be having a dynamic string structure and have functions that operate it more extensively than the standard library. However, I don't want to delete...
Alright, thanks!
I am currently using this code...
for (int i = 0; i < m_size; i++)
m_array[i] = EMPTY_CELL;
EMPTY_CELL is -666.
m_array is a dynamic array pointing to an integer.
Instead of using an O(n)...
I would like to find a data structures book that uses straight C, is designed pretty well, helps you build your own little data structures library, etc. Any recommendations would be great, thanks.
I'm not sure how vector does it. What do you mean as an undefined behavior? I don't know if this would make much sense...
Datatype& operator[] (const int p_index)
{
if ((p_index >= 0)...
I got a small problem. I have an array class and it returns an index as a reference so it can be accessed or modified.
// Allows accessing and modifying the array's contents.
Datatype&...
That's getting there. I didn't get any crashes this time around.
I was expecting:
10
20
30
Instead, I got:
0
20
C++: The Complete Reference, 4th edition by Herbert Schildt. It really is a one-stop reference. I use it all the time as a reference book. It's a great tutorial for beginners too and teaches more STL...
Okay.
I'm still wondering why the for loop keeps going. It could be the forth() method perhaps.
Edit: ah ha, it's not the for loop but the destructor. I wonder what would be causing it. It's...
Okay, thanks for letting me know.
Thanks for the responses. It was too difficult for me to get two files talking to each other, so I combined both classes in one file, added a forward declarion, and it compiled fine. I don't know if...
Each class is in its own header file. I wonder if it's just the wrong includes on top? The syntax looks fine, so if its just having a problem with SListIterator, it seems that its not the code but...
I was carefully going through the examples in a book of mine. Everything was going fine until I created the SListIterator class. It keeps pointing at its constructor. I tried everything but no luck....
There is something that I would really enjoy in C++ if it is possible.
class Console
{
public:
template <class T> static void WriteLine(T text)
{
std::cout << text << std::endl;
Yeah, I just googled that. I had to go to Project - Properties - C++ - Language - Enable Run-Time Type Info. I thought it was on by default. Thanks for the help. It's working as expected now.
Makes sense. I added a virtual destructor to class Mammal. As I compiled, I got the following warning:
warning C4541: 'typeid' used on polymorphic type 'Mammal' with /GR-; unpredictable behavior...