--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00009 Date: 04/14/97 From: HERMAN SCHONFELD Time: 07:56pm \/To: PAUL MADDOX (Read 5 times) Subj: Rating of C++ PM>Frank, FM> This view is shared by the designers of C++. Nevertheless, FM> C++ has enough OOP extensions to meke it quite useful in FM> modeling objects...." PM>Sounds VERY strange to me! :-) In fact, I'd almost say "rubbish". FM> Am I wasting my time - even if it IS only a hobby with FM> no purpose to make a career of it (I'm too old). PM>In the words of MANY people "C++ is a real programmer's language" PM>I say "amen". :-) PM>If you want to program a game, don't even THINK of doing it in Pascal, PM>there are about 2 people worldwide who write games in Pascal, and PM>they're PM>thinking about moving to C/C++.. ;-) Have you ever taken the time to look at DJ-Pascal? Well, if you did you'd notice how FAST it compiles and production time is very quick. I only wish I knew of this before I moved onto C++ so I wouldn't of forgotten the language. Bye for now.. ... Any of you seen a modem carrier around here? --- Ezycom V1.48g0 01fd016b * Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00010 Date: 04/14/97 From: HERMAN SCHONFELD Time: 07:59pm \/To: CHRISTIAN ANDERSEN (Read 5 times) Subj: Rating of C++ CA>Hello Herman. CA>11 Apr 97 20:42, Herman Schonfeld wrote to Pierre Phaneuf: HS> I fail to see the big hype about OOP & OOD. HS> Please explain where it can be used and how this will make it CA>better. HS> I am thouroughly familiar with OOP & OOD so there's no need for a HS> definition. CA>I think it is a matter of personal preferences, whether you like it or CA>not. But CA>for me it helps me break large projects down to smaller more CA>comprehensible CA>parts. CA>As an example, I have lately been working on quite a big project, CA>programming a GIS program, for the Danish Institute for Arctic CA>Exploration. The basic idea is to read some files containing vector data CA>(coordinates collected with a Global Positioning System in an airplane) CA>and some other files containing bitmap data (satellite-photos). CA>The basic idea is, that these files have to be read into the program an CA>analysed in respect to each other. CA>The files are very different in structure (binary vs. text) and drawing CA>methods (Bit-Blitting vs. GDI-commands), but they will be used in the CA>same way in the same window in the same program. CA>The way to go, is to look at each file type as an object, and then CA>design the objects with a common interface. Each filetype object is CA>responsible for doing its own reading of files, drawing on the screen CA>and doing it's own cleanup. CA>I can desing a object for each filetype and test it in its own test CA>application, so I wont have to worry about destroying some of the things CA>that already work (and saving compiletime, while testing). CA>The really cool thing, is that the next time I have to make a project of CA>that kind, I just enherit a new object from the objects that already CA>work. Well in that case :) I tried using a fixed point class in an application I was writing but the overhead was too much to bear :). By the way, What kind of firm do you work for? How do you get these kind of jobs? I thought the gfx industry was dead. Obviously not :) CA>Christian ... Fh|$ fagL|ne made fGfm GScYcLed ac|| chaGacfSG$ --- Ezycom V1.48g0 01fd016b * Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00011 Date: 04/12/97 From: CHRISTOPHER BUTLER Time: 08:51am \/To: CLIFF RHODES (Read 5 times) Subj: bytes :) *** Answering a msg posted in area PERSONAL_MAIL (Personal mail). Hello Cliff! Tuesday April 08 1997 21:02, Cliff Rhodes wrote to Christopher Butler: CB>> If I've got two variables, stored as arrays of 3 bytes: CB>> CB>> typedef byte DateType[3]; CB>> CB>> How do I test whether one is greater than the other? :) CR> PS: Why isn't this a class instead of a type? Its defined in the ProBoard SDK, which is not specifically for C++ :) Christopher E-Mail: chris@db-bbs.coracle.com --- FMail/Win32 1.22 * Origin: Death Butler BBS, +44-1582-620141, 24 Hours (2:257/135) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00012 Date: 04/12/97 From: CHRISTOPHER BUTLER Time: 08:54am \/To: HERBERT BUSHONG (Read 5 times) Subj: bytes :) *** Answering a msg posted in area PERSONAL_MAIL (Personal mail). Hello Herbert! Wednesday April 09 1997 11:03, Herbert Bushong wrote to Christopher Butler: ::>> typedef byte DateType[3]; HB> not with this you don't, you've only decared a data type (and HB> incorrectly). That should be: HB> typedef char byte; HB> byte Datatype[3]; Its defined in the ProBoard SDK.. nowt to do with me... and byte ios defined just before it (as an unsigned char)... ::>> How do I test whether one is greater than the other? HB> Of course, since this is the C++ conf, you should probably HB> encapsulate it in a class Possibly :) But, its a PB SDK as I say, not specifically for C++ :) Christopher E-Mail: chris@db-bbs.coracle.com --- FMail/Win32 1.22 * Origin: Death Butler BBS, +44-1582-620141, 24 Hours (2:257/135) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00013 Date: 04/12/97 From: STEPHEN GAGE Time: 10:00pm \/To: ALL (Read 5 times) Subj: Random access files Hi! I'm trying to write a program that will read a hudson message base, and convert any new messages to files, which can then be read in Internet Explorer or similar. I've hit a brick wall straight away; I can't read from the hudson message base! Well, tell a lie, I have managed to get some code to work in Visual Basic, ut that is so slow that it is unusable (it takes around 1 hour to toss 50 messages, on a 686/150+). I've got a spec of how the Hudson message base is stored, but I can't read he files from the disk! I have a spec similar to the following: char* FromName[36]; char* ToName[36]; char* Subject[72]; int origzone; int destzone; etc... How do I read the n'th chunk from the disk? I'm learning c++ at Uni, but I'm only a first year, and we've only used the file streams so far... I think I will probably need to use structs as well, but I have no experience whatsoever of using these beasts. Thanks for your help $teve sjg@cs.bham.ac.uk --- FMail 1.22 * Origin: (2:2500/607.15) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00014 Date: 04/11/97 From: WIM VELDHUIS Time: 10:11pm \/To: CLIFF RHODES (Read 5 times) Subj: inheritance in C++ Cliff Rhodes wrote in a message to Balog Pal: --> Balog Pal wrote to Wim Veldhuis <-- BP> WV> class Derived : public Base BP> WV> { BP> WV> typedef Base Inherited; BP> WV> }; BP> BP>Hm, this really solves some of my problems. I didn't notice before BP>that typedef also can be scoped in a class. CR> Paul or Wim, I missed some of this thread. What is the CR> benefit to you of using this typedef? I'm curious what CR> problem it solves. Thanks. The benefit is that you define an alias for the ancestor class which means that you can use the alias in the class in which it is defined in stead of directly coding it. This makes a difference when you change the ancestor class (like inserting an extra layer in the inheritage tree). It also can be used to define another class like is done in the STL. There you use vector::iterator to specify a class which resolves to the class name of the iterator for a vector. p.e. class base { public: virtual int foo(); { return 0; } }; class Derived : public base typedef base Inherited; public : virtual int foo(); }; class NewBase : public base { public: virtual int foo() {return 10; } }; int Derived::foo() { return Inherited::foo() + 1; } If you change the inheritance so Derived descends from NewBase and you adjust the typedef in the class declaration, Derived::foo will call NewBase::foo(). If you have a lot of calls to the ancestor class this will increase maintainability a lot. mvg/wr --- timEd/2 1.01.g3+ * Origin: LightHouse BBS ==> I am a H.U.G.O. Member ! (2:285/324.3) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00015 Date: 04/13/97 From: PIERRE PHANEUF Time: 06:32pm \/To: HERMAN SCHONFELD (Read 5 times) Subj: Rating of C++ HS> I fail to see the big hype about OOP & OOD. HS> Please explain where it can be used and how this will make it better. HS> I am thouroughly familiar with OOP & OOD so there's no need for a HS> definition. For example, in this OO database I made (a casket inventory management program, where a casket is made of a case, handles/ornaments, an interior, plus some options (lighting, sealing, etc...)), there's a TItem class and a TModel class, which is a descendant of TItem. I have this single database of TItem, that (through polymorphism) can contain both TItem objects and TModel objects. So you can sell both a complete casket (a TModel object) or a single replacement handle for a broken one (a TItem object). In *both* cases, those use the same code. This is a simple example, but for me, the biggest time saver is the sharing of code for multiple cases in a single program, next comes code reuse between many programs (like my filter classes, to encrypt/decrypt, compress/decompress, all on the fly, through a stream. Pierre ... Two most common elements in the universe: Hydrogen & Stupidity. --- FMail/Win32 1.20 * Origin: Real Programmers don't wear socks. (1:167/136.14) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00016 Date: 04/13/97 From: PIERRE PHANEUF Time: 06:45pm \/To: NICK SHREDERS (Read 5 times) Subj: DJGPP OPTIMIZATIONS NS>> Whenever I compile my Linux kernel with GCC I notice a slight NS>> performance increase when i compile it with the PENTIUM option in NS>> the config, rather then the 486 (I have a 486). PP>> Really? Would you actually recommend this? NS> What I recomend is doing what Linux was made for - experimenting with NS> it to see whats best fit for your system. Yes, of course! :-) Pierre ... What do you mean? You actually read this tagline?!? --- FMail/Win32 1.20 * Origin: Real Programmers don't wear socks. (1:167/136.14) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00018 Date: 04/13/97 From: PAUL WANKADIA Time: 08:56pm \/To: THOMAS MAEDER (Read 5 times) Subj: self-destruct On 10 Apr 97, Thomas Maeder wrote to Paul Wankadia -- PW> I'm wondering how to, from an object's constructor, to self-destruct PW> if there is some kind of error, the object will NOT be created. TM> The approach is fundamentally wrong. You can only destroy an object TM> that has been constructed, so destruction from the constructor isn't TM> possible. You know bloody well what I mean... {snrk} TM> The only thing that comes near to what you suggest is throwing an TM> exception in the constructor. This will prevent the object from even TM> being (fully) constructed. But if you want to do that, you have to TM> write exception-safe code, which isn't an easy thing to do. Well, I only want to create the object once at a definite place in the code, so... PW> Could someone please tell me how to do this and how to detect if the PW> has been created or not? I'm accessing the object thru a pointer (u TM> You can't do that except by catching an exception. Well, tell me everything I need to know ... and then some. TM> But I'm sure that there's a way to solve your problem without. (PW slaps his head.) I know my code is (ahem) "exceptional", but this is ridiculous... TM> Could you please give more details about what you want to do? I (and TM> other people here) will be happy to help you; sounds interesting! I'll post some code in my next message ... ... you'd better promise not to laugh. --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: E4J00019 Date: 04/13/97 From: PAUL WANKADIA Time: 09:01pm \/To: ALL (Read 5 times) Subj: comp.lang.c++.object.die.die.die Here's some of my code re self-destructing objects. It's for DJGPP, there are probably several lines that are going to be either truncated or split at awkward positions and the TABs will be flying all over the place. See if you can make sense out of it ... and you'd bloody well better not laugh. ===== /* PUNIX.H ~~~~~~~ Contains all "stuff" for PUNIX. */ #ifndef __PUNIX_H #define __PUNIX_H // defines // ~~~~~~~ #define PROG_NAME "PUNIX" // the program name #define PROG_VERSION "0.01" // the program version #define ABORT_AND_NOTHING_QUITS // comment out to make user enter quit|exit to get out // prototypes // ~~~~~~~~~~ int check_input(char *); // checks entered input class PUNIX_prog { // fairly useless class private: int _argc; char **_argv; public: PUNIX_prog(int, char **); // small constructor ... ~PUNIX_prog(); // ... and destructor int check_args(); // checks the command-line parameters void status(); // show current system status void online_help(); // show some online help for user void send_msg(char *, int = 0); // prints the message to the console with or without "\r\n" }; #endif ===== /* MAIN.CPP ~~~~~~~~ Contains main(). */ // include files // ~~~~~~~~~~~~~ #include #include #include #include #include #include "punix.h" // general program constants // ~~~~~~~~~~~~~~~~~~~~~~~~~ class PUNIX_prog *prog; int main(int argc, char **argv) { prog = new PUNIX_prog (argc, argv); // create object for program if (prog == NULL) return 1; cprintf("\r\n"); char *input = new char[101]; // create variable for input while (1) { // loop until broken char *current_path = new char[MAXPATH]; getcwd(current_path, MAXPATH); // get the current path and . . . cprintf("%s : ", current_path); // . . . and make it the prompt delete current_path; int quitting = 0; if (!get_input(input, 101)) { // if not aborted . . . switch (check_input(input)) { // . . . check the nput case 0 : if (stricmp(input, "")) cprintf("\r\n"); // if input, print blank line, then . . . break; // . . . just continue or . . . case 1 : quitting = 1; break; // . . . quit out } } #ifdef ABORT_AND_NOTHING_QUITS else if (!stricmp(input, "")) break; // if abort and nothing entered -- quit #endif if (quitting == 1) break; } delete input; // kill variable cprintf("\r\n"); delete prog; return 0; } ===== /* PROG.CPP ~~~~~~~~ Contains functions for class PUNIX_prog. */ // include files // ~~~~~~~~~~~~~ #include #include #include #include #include #include #include #include "punix.h" PUNIX_prog::PUNIX_prog(int argc, char **argv) { cprintf("\r\n"); send_msg(PROG_NAME " v" PROG_VERSION ","); send_msg("compiled on " __DATE__ ", at " __TIME__); _argc = argc; _argv = argv; if (!--_argc || !check_args()) { send_msg("Seeding random number generator ... ", 1); srand(1); // seed random number generator send_msg("done\r\n", 2); send_msg("Masking Ctrl-C = abort ... ", 1); __djgpp_set_ctrl_c(0); // do not kill program if Ctrl-C hit send_msg("done\r\n", 2); send_msg("Masking Ctrl-Break = abort ... ", 1); _go32_want_ctrl_break(1); // do not kill program if Ctrl-Break hit send_msg("done\r\n", 2); send_msg("Init completed."); } else delete this; } PUNIX_prog::~PUNIX_prog() { send_msg(PROG_NAME " terminated."); send_msg("very long string that will probably be destroyed utterly"); } int PUNIX_prog::check_args() { int args_found = 0; for (int arg_number = 1 ; arg_number <= _argc ; arg_number++) { if (!stricmp(_argv[arg_number], "--test")) { send_msg("parameter \"--test\" recognised."); args_found++; } } if (args_found != _argc) { send_msg("One or more parameters not recognised."); return 1; } return 0; } void PUNIX_prog::status() { cprintf("Currently, there is no status info.\r\n"); return; } void PUNIX_prog::online_help() { cprintf("help ]- get this help screen\r\n" "? ]\r\n" "exit ]- quit " PROG_NAME "\r\n" "quit ]\r\n" "status -- get the current system status\r\n"); return; } void PUNIX_prog::send_msg(char *output, int newline) { time_t current_time; time(¤t_time); char *str_current_time = ctime(¤t_time); *(str_current_time + 24) = '\x00'; switch (newline) { case 0 : cprintf("%s : %s\r\n", str_current_time, output); break; case 1 : cprintf("%s : %s", str_current_time, output); break; case 2 : cprintf("%s", output); break; default : break; } return; } ===== --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3)