Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (JAMES ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: inlines and __LINE__ Message-ID: <10229@microsoft.UUCP> Date: 11 Jan 90 17:15:24 GMT References: <2381@ektools.UUCP> Reply-To: jimad@microsoft.UUCP (JAMES ADCOCK) Distribution: usa Organization: Microsoft Corp., Redmond WA Lines: 21 In article <2381@ektools.UUCP> randolph@ektools.UUCP (Gary L. Randolph) writes: >Please tell me I'm missing something obvious here! >I want to use __LINE__ in an inline function as follows: Your missing something obvious here. [Which I'm well aware of, having tried this once too.] Namely CPP macro expansion happens before any C++ stuff, so when C++ sucks up the inline function to be regurgitated later [suitably modified] __LINE__ is already 9. So, in fact, as claimed, inlines are not macros, and excepting bugs work just like normal function calls except generating bigger, faster, harder to debug code -- and also doing a real good job of exercising any remaining bugs/restrictions in your underlying C code generator. --I would claim this is just yet another indication that CPP is a hack, and needs to be replaced with features in the language/compilers to handle most normal everyday programming tasks, including debugging support, import/export, asserts, condition compilers, templates, etc. CPP is untyped, unsafe, frequently used in unsyntactic ways, etc. Try writing reasonable tools to munge C/C++ sources. You can't. To parse C/C++ code you have to have valid syntax, and strict knowledge of when a word is a type-identifier, and CPP defeats all this. IMHO. [Not to rekindle an old flame]