Sender: crough45 AT amc DOT de Message-Id: <97Oct4.172843gmt+0100.11649@internet01.amc.de> Date: Sat, 4 Oct 1997 16:33:24 +0100 From: Chris Croughton Mime-Version: 1.0 To: djgpp AT delorie DOT com Cc: kwall AT utw DOT com Subject: Re: Bad debugging code for class functions in header Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Kurt Wall wrote: > Tsk, tsk. Putting code in a header file... You obviously don't program in C++. There is a very valid reason for putting the code in the class definition: it's the /only/ way to get inline functions (when the compiler does inline them - for debugging I need to run with optimisations off). And since in C++ you are supposed to use inline functions instead of macros, there's nowhere else to put them (for that matter what is a macro except code in a header file?). Now if it were a proper high-level language, where you could export code from a module so the compiler could just insert it, and you wouldn't have to define everything twice, that would be different. In a real HLL I could have module which said something like: export class foo { void fred() { ... } }; and the compiler would generate an internal-format file which contained all the declarations and definitions required for another module to import and inline the function calls. But it isn't, it's C++, and it doesn't work (as far as debugging is concerned) on the DJGPP port as far as I can see. (Actually, I don't know if even Ada and Modula do this properly either. It depends on whether the compiler and linker can handle it, most seem to not generate inline code for such cases...) Chris C