--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGL00000 Date: 12/16/97 From: ALBERTO MONTEIRO Time: 09:37am \/To: THOMAS MAEDER (Read 2 times) Subj: What's wrong with this? AM> What's wrong with this code? I guess the temporary object created in AM> operator+ member is lost somewhere, but I don't know why, and I don' AM> know how to make it work :-( TM>What doesn't work? What's the output of the main() function? I don't TM>see any "fatal" problems in your code. But allow me some remarks: It didn't work because I run it in M$C, after I made some mistakes and put some dirty stuff in the memory. I guess the new was returning 0. AM> class Vector AM> { AM> public: AM> double x, y; TM>Don't make these public. Better declare them private and provide TM>inline accessor methods: TM>private: TM> double x, y; TM>public: TM> double X() const { return x; } TM> double Y() const { return y; } What is the advantage of this? I mean, besides aesthetical considerations :-) AM> Vector(double xx = 0, double yy = 0); // constructor TM>This constructor may cause you problems (not in the main() function TM>you give below, though) like every constructor taking one argument: it TM>can be used by the compiler for implicit conversions. ??? How can it give problems? AM> Vector::Vector(double xx, double yy) AM> { AM> x = xx; AM> y = yy; AM> } AM> Vector::Vector(const Vector & V2) AM> { AM> x = V2.x; AM> y = V2.y; AM> } TM>Initialize the members in the member-initializer-list rather than in TM>the constructor's body: TM>Vector::Vector(double xx, double yy) TM> : x(xx), TM> y(yy) TM>{ TM>} TM>Vector::Vector(const Vector & V2) TM> : x(V2.x), TM> y(V2.y) TM>{ TM>} Ok. But as you must have imagined, I wish to generalize it to a n-dimensional Vector. Then I guess I can't initialize them this way Alberto Monteiro --- SLMR 2.1a Bred to kill, not to care/do just as we say (Metallica) --- FMail/386 1.02 * Origin: CentroIn! +55-21-205-0281, 41 lines, 24h, RJ/Brazil (4:802/21) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGL00001 Date: 12/16/97 From: ALBERTO MONTEIRO Time: 07:31pm \/To: CAMERON CLARK (Read 2 times) Subj: What's wrong with this? AM> Vector(double xx = 0, double yy = 0); // constructor CC> Are two default values legal? I guess it is AM> Vector Vector::operator+(const Vector & V2) const AM> { AM> Vector add; AM> AM> add.x = x + V2.x; AM> add.y = y + V2.y; AM> return add; AM> } It wasn't working since I had comminted a mistake before, using new with a wild integer. I guess the temporary storage area was full of garbage, so temporary objects were crazy. CC>String operator+(String& left, String& right) { CC> String str; CC> strcat(str.s, left.s); <- I guess here it should be strcpy CC> strcat(str.s, right.s); CC> str.getLength(); CC> return str; CC>} CC> I used the same type of temporary in the same type situation CC> with no problems. CC> return str; CC> Returns the value of the 'str' object before it is deallocated. I had used the operator+ as above, but latter I found it would be more elegant to make it a member function Alberto Monteiro --- SLMR 2.1a Build my fear of what's out there (Metallica) --- FMail/386 1.02 * Origin: CentroIn! +55-21-205-0281, 41 lines, 24h, RJ/Brazil (4:802/21) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGL00002 Date: 12/16/97 From: JEREMIAH ONEAL Time: 08:33pm \/To: RICKY HOBSON (Read 2 times) Subj: Is anybody out there? -> ->> ->> DB> This area is a bit empty don't you think? Any novice -> ->> or ->> DB> experienced programmers out there who want to talk -> ->> DB> ->> programming drop us a line. -> ->> ->> -> ->> ->> I'm a novice in C++ and used to do some Pascal. I'm a -> ->> senior ->> in high and am learning C++. I am tring to get -> ->> code to ->> display BMP, PCX, and images. Can you tell me how -> ->> to do ->> sprites for a game I am tring to program? Any code -> ->> for ->> displaying PCX, and or any other image formats be very -> ->> ->> apreach'ed! Thanx -> ->> ->> -> ->> ->> --- -> ->> ->> * Origin: The Matrix (1:124/6308.4) -> ->> -> ->> JO> No. But i have a Question. -> ->> JO> When where you a beginer in Pascal? And what Pascal -> ->> program JO> Version did you use? I am begining in TP Version -> ->> 4. -> ->> -> ->> JO> Thanks:) -> ->> -> ->> About a year and a half ago. I usually used TP7. It is more -> ->> compreh in showing you how to fix your problems. -> ->> -> ->> --- -> ->> * Origin: The Matrix (1:124/6308.4) -> JO> So you where in Gread 10 1/2 ? -> JO> I am starting to learn Turbo Pascall V.5 and i am in gread 10 -> JO> witch soon will be 10 1/2. -> JO> Thanks :) -> I was in 11th grade. -> I'm a senior now. -> --- -> * Origin: The Matrix (1:124/6308.4) Ok, So i need to get to the book's in 1/2 Year's! Kewl. I dont need to do anything for 1/2 Years! :) --- Platinum Xpress/Win/Wildcat5! v2.0 * Origin: BJ's Place BBS, Spring Valley, Ca. (1:202/1002) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGL00003 Date: 12/16/97 From: CAMERON CLARK Time: 04:45pm \/To: THOMAS MAEDER (Read 2 times) Subj: Re: C to C++ CC> Personally, I think the only difference is object oriented progr CC> and the library. TM> TM> Don't forget function and operator overloading, better compile- and TM> link-time type checking, namespaces, inline functions, templates, ... Henceforth the 'Personally' preceeding my statement. I think the most important addition is the object oriented programming. (run-time binding allows for polymorphish and is a necessity modern OO languages) --- GEcho 1.00 * Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGL00004 Date: 12/14/97 From: JAN BIJSTERBOSCH Time: 11:47am \/To: DAN CHAK (Read 2 times) Subj: DJGPP and allegro Hello Dan, 08 Dec 97, Dan Chak of 1:141/1135 wrote to All DC> To anyone who uses DJGPP and Allegro.. Bingo... DC> I am trying to compile Allegro but get the following errors DC> when running DC> MAKE. DC> e:\djgpp\allegro>make DC> gcc -I. -Isrc -Wall -o obj/bank.o -c src/bank.S DC> e:/djgpp/tmp\ccbaaaaa: Assembler messages: DC> e:/djgpp/tmp\ccbaaaaa:252: Error: register does not match DC> opcode suffix DC> e:/djgpp/tmp\ccbaaaaa:269: Error: register does not match DC> opcode suffix DC> make.exe: *** [obj/bank.o] Error 1 DC> When I delete references to bank.o (the above problem) in DC> the makefile, [ a lot snipped ] Hmm, I presume your DJGPP installation is working correctly? If you're not shure try a simple "Hello World" program. For making Allegro version 2.2 you need the C++ part of the DJGPP v2.01 package too, so if you haven't, install that first (see readme.1st for what you need). If the above things are correct on your harddisk, the problem could be with your version of make. I seem to remember that a space between the make directive and the following double colon resulted in a lot of errors. You could try to edit these spaces out of the Allegro makefile, or get a slightly older version of make. The one I used was version 3.75 and worked without a glitch. DC> DC> Any suggestions on why I'm getting these errors?? Hope this helped somewhat... DC> Thanks, DC> Dan Chak Greetings from sunny Amsterdam, Jan email:bijster@worldonline.nl http://www.worldonline.nl/~bijster --- MBM v3.41e * Origin: Snuffelaar bij DosBoss West (2:500/121.5122) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGM00000 Date: 12/16/97 From: DANIEL GUSTAFSSON Time: 10:04pm \/To: MODERATOR (Read 2 times) Subj: conf Can you please supply me with the conference rules and correct description to ensure me that my configuration is correct? /can --- FMail 1.22 * Origin: -(eternal dreams / +46-18-245607 / 24h)- (2:206/145.144) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGM00001 Date: 12/17/97 From: THOMAS MAEDER Time: 06:31pm \/To: ALBERTO MONTEIRO (Read 2 times) Subj: What's wrong with this? AM> TM> double X() const { return x; } AM> TM> double Y() const { return y; } AM> What is the advantage of this? I mean, besides aesthetical AM> considerations :-) That the class can prevent the members from being overwritten from outside. AM> AM> Vector(double xx = 0, double yy = 0); // constructor AM> TM>This constructor may cause you problems (not in the main() fun AM> TM>you give below, though) like every constructor taking one argumen AM> TM>can be used by the compiler for implicit conversions. AM> ??? How can it give problems? For example if you change a function parameter from a C-style array to your Vector class (extended to more dimensions): The first version might have looked like this: void f(double *vector) {...} which can be called like this: f(0); If you now change f to void f(Vector &v) {...} this call still compiles, because 0 is now silently converted into a Vector. Declaring the constructor explicit would prevent the compiler from performing this silent conversion: explicit Vector(double xx = 0, double yy = 0); // constructor AM> TM>Initialize the members in the member-initializer-list rather th AM> TM>the constructor's body: [...] AM> Ok. But as you must have imagined, I wish to generalize it to a AM> n-dimensional Vector. Then I guess I can't initialize them this way No, I didn't imagine that (although I admit that I might have...). Yes, you are right. But then I'd suggest that you use the standard vector template. Thomas --- MM 1.0 #0113 Pit crew guys do it in 7 seconds. --- PCBoard (R) v15.22/M 25 * Origin: McMeier & Son BBS (2:301/138) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGM00002 Date: 12/17/97 From: BJOERNAR JENSEN Time: 11:22pm \/To: JAVIER KOHEN (Read 2 times) Subj: absread() >> Unrecognized symbol in absread(int,int,long, void far*); in >> READBOOT.CPP > Add the line "#include " by the code beggining... I do believe I already got that one :) Beej --- BBBS/L v3.33 How * Origin: Errors HQ: Prog/Emul/Linux/Demos, +47-55590830 (2:211/16) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGM00003 Date: 12/17/97 From: BJOERNAR JENSEN Time: 11:25pm \/To: CAMERON CLARK (Read 2 times) Subj: Re: absread() >> If you don't typecase your buffer as a (void*) then the >> parameters do not match - and the function is not instantiated. >> Thank you. > Was that the problem? (using a char* and not a void*?) I do not know. I'm using Windows '95, and it went to H..l I didn't get to test it. :/ Bjoernar Jensen --- BBBS/L v3.33 How * Origin: Errors HQ: Prog/Emul/Linux/Demos, +47-55590830 (2:211/16) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EGM00004 Date: 12/17/97 From: JEREMIAH ONEAL Time: 05:14pm \/To: JONATHAN ROBERTS (Read 2 times) Subj: Is anybody out there? -> RE: Is anybody out there? -> BY: Jeremiah Oneal to Ricky Hobson on Fri Dec 12 1997 07:28 pm -> -> OTE: DCTEdit v0.01 -> > you use? I am begining in TP Version 4. -> -> I would suggest getting 7.0 or at least 6.0. The 3.xx/4.xx versions -> are lacking some useful features. -> -> gremlin -> -> - Gremlin -> -> -> ... A cat's worst enemy is a closed door. -> --- Synchronet+SBBSecho v1.25 -> * Origin: The Caverns BBS - 504.831.2825 (1:396/20) Ok, Well i got 5.0. Is that a good one? Thats the tipe Dr. Zetties uses who is the one teaching me. --- WILDMAIL!/WC v4.10 * Origin: The Mystic Tower BBS Santee, CA (619) 596-0271 (1:202/330.0)