|
|
On 4/20/2012 5:11, Warp wrote:
> Darren New<dne### [at] sanrrcom> wrote:
>>> The book claims that if you write a function body inside a class definition,
>>> that makes the method inline. Is this true? I thought there was no
>>> difference either way...
>
>> It *has* to be.
>
> It doesn't *have* to be (any more than any other function defined in a
> header file, or anywhere else), but the standard says it is, and so it is.
I meant, it *has* to be or it will link but won't compile, because you wind
up compiling a version of the header file in each .c file it's included in.
Sure, it doesn't *have* to be implicitly inline, but since every function in
a header file is either inline, or shouldn't be in the header file in the
first place, or fails to link, it made sense to make the default "yes,
please work."
--
Darren New, San Diego CA, USA (PST)
"Oh no! We're out of code juice!"
"Don't panic. There's beans and filters
in the cabinet."
Post a reply to this message
|
|