![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
existential crisis about C./C++ and makefiles |
Neil Roy
Member #2,229
April 2002
![]() |
http://support.microsoft.com/kb/830473 said: On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters. Never had a problem with it myself. --- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
I remember trying to do a "dir /s > /dir.txt" and having all kinds of PATH TOO LONG errors scroll by with truncated lines in the text file, just because MS likes to bury stuff nine directories deep. They all watch too much MSNBC... they get ideas. |
Neil Roy
Member #2,229
April 2002
![]() |
I just tried that command out (took a while!) and had no problems at all. But that is what you would download CoreUtils for, so you could use ls instead. But it did work for me. Total Files Listed: 89247 File(s) 99,000,874,321 bytes 24296 Dir(s) 304,396,386,304 bytes free
And that was just from my user folder, glad I didn't do it from root. --- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Could you try a "wc -L /dir.txt"? (get length of longest line) They all watch too much MSNBC... they get ideas. |
Neil Roy
Member #2,229
April 2002
![]() |
216. I just done it from root so I could be sure to get the longest. --- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
You haven't installed the Direct X SDK, have you? They all watch too much MSNBC... they get ideas. |
Neil Roy
Member #2,229
April 2002
![]() |
Not yet, no. I had it on XP, I should try that on my old XP drive, it's still cluttered with old XP stuff.... [edit] --- |
William Labbett
Member #4,486
March 2004
![]() |
Edgar Reynaldo said:
There is an excellent tutorial for C++ here : Seems good but I'm reading the bit on Classes II and it introduces this : Vector& but I can't find any explanation for it earlier. Don't worry, I've got a C++ book where it's explained.
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
A reference (object&) works like a regular object but allows you to directly modify another object without explicitly using a pointer to it. void set_to_5(int& i) { i = 5; } int num = 0; set_to_5(num); printf("num is %i\n" , num);// "num is 5" From the example they gave, they are using a class method to return a reference to the object in use. This is useful because it allows you to chain function calls. Take for example the basic prototype for operator << for ostream : template <class Type> ostream& operator<<(ostream& os , const Type& t) { os << t; return os; } ostream os; os << a << " plus " << b << " is " << a+b << std::endl; // (os << a) returns a reference to os, so after this call it becomes // (os << " plus ") and so on...
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
![]() |
I tried references one time and kept getting compile errors, used them just like you did and I ended up changing them to pointers. Would have been nicer to have the references. It was just a basic function at the time like [EDIT] actually it was class I made I was trying to pass. [Edit2] Nvm, my bad. --- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
You didn't compile as regular C, did you? They all watch too much MSNBC... they get ideas. |
Neil Roy
Member #2,229
April 2002
![]() |
It worked when I changed it, considering it uses a class (sorry, just edited as you were replying I think), I definitely compiled it as C++. [edit] --- |
bamccaig
Member #7,536
July 2006
![]() |
Being a class has zero to do with references in C++. Show us the code and we'll help you understand it. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Neil Roy said: I think because it is a class, it's already a pointer and so there is no need for a reference. Being a class doesn't make it a pointer. If you want to modify an object directly in a C++ function you have to use a reference or a pointer. class Ex { public : int x; Ex() : x(0) {} }; void SetTo(Ex& ex , int x) { ex.x = x; } Ex ex; SetTo(ex , 5); if (ex.x == 5) {printf("Yay, references work!\n");}
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
![]() |
I went back and took a look at my code again and it seems to work better now. The problem is I have an array that I was passing. void Draw_Everything(Ball &ball, Paddle *paddle) paddle is an array (paddle[2]), ball is not, so I can use a reference on ball, a pointer on paddle and this way when I call Draw_Everything() I don't need any reference & pointers on either, which is nice. Been trying to minimize global variables which I have been really bad for in the past. I do like how much more neat and tidy C++ classes seems to be making the code which will help in tracking down bugs I imagine. As I port over old projects, I'll make an attempt at converting to C++ and see how that goes. I have an asteroids "game" (not really a game, just some asteroids floating around) that was an excersize in using linked lists. I looked at it and realized it would convert into a C++ class really easily. There's basically an asteroids struct, with a bunch of functions for handling various things like adding a new asteroid, initializing it, functions for moving it etc... --- |
bamccaig
Member #7,536
July 2006
![]() |
There are objects available in C++ to use for arrays instead of raw sequential memory blocks and pointer arithmetic. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
|
1
2
|