Leon Mergen wrote:[color=blue]
> Hello,
>
> On Mon, 2005-07-04 at 11:43 -0700,
ambar.shome@gmail.com wrote:
>[color=green]
>>As far as my knowledge goes ".h" files are for declaring function
>> prototypes and variables only. We dont write the body of the function
>> within a header file. That might be the reason why r u getting this
>> compilation error.[/color]
>
>
> As far as my knowledge goes, this is being done on a pretty common base.
> For example, the Spirit parser (
http://spirit.sf.net/ ) is written
> entirely in header files.[/color]
The Spirit parser is implemented using template meta-programming
techniques, which is a different beast altogether from
header/implementation separation.
The STL is implemented using "header" files, they just contain template
definitions and don't have the .h extension. They also don't need to be
explicitly sent to the compiler (but referenced via #include instead)
because of the way templates work during compile time.
[color=blue]
>
> I know that header files are supposed to be for defining functions, but
> isn't this rather for /other/ classes that include this class ? I mean,
> as I see it, the strict separation between header files and source files
> is because that way a compiler can look at a header, know what functions
> a certain class accepts, and then parse one class accordingly... you do
> not need a pure definition of the class YET... but what's so much
> against it, if it's possible ? Sure, if a class includes a class that
> tries to access member functions of the class including it (sheesh, what
> a sentence :)), sure, you need separation between header and source so
> it can be solved at compile-time... but why do you need to do this all
> the time, especially for the simple functions the parent post is using ?
>
> Regards,
>
> Leon Mergen
>[/color]