From: Pavel R. on
I have a few questions :

a. "It is guaranteed that any functions whose body is written in the
interface is inline." Seriously?


b. This is the constructor definition; the implementation seems
irrelevant.
BitArray(int size = 320);
BitArray B(50); // call size with size 50
BitArray A; //call size with size 320 << shouldn't this be legal?
BitArray C(); //illegal <<< Shouldn't this be illegal?

c. What debugger do you recommend?
I am on Ubuntu Linux.


Thank You
From: Ike Naar on
In article <593a5891-7cc7-4ed4-8aea-0837b9b33e20(a)k22g2000vbp.googlegroups.com>,
Pavel R. <razoredx(a)gmail.com> wrote:
>b. This is the constructor definition; the implementation seems
>irrelevant.
>BitArray(int size = 320);
>BitArray B(50); // call size with size 50
>BitArray A; //call size with size 320 << shouldn't this be legal?

It is legal.

>BitArray C(); //illegal <<< Shouldn't this be illegal?

It is legal, but it means something else than what you probably
think it means:

BitArray C();

declares a function named C, that takes no arguments and returns
a BitArray; it does *not* declare a BitArray object named C, initialized
with the default size. If you want the latter, use

BitArray C;

Regards,
Ike
>
>c. What debugger do you recommend?
>I am on Ubuntu Linux.
>
>
>Thank You


From: Ronald Landheer-Cieslak on
See Ike's response for the BitArray question.

Pavel R. wrote:
> I have a few questions :
>
> a. "It is guaranteed that any functions whose body is written in the
> interface is inline." Seriously?
Be careful with this: constructors especially may need to do a lot more
work that what you write in your function body. You may be in for
serious code bloat if you inline seemingly trivial things.

Also be careful about breaking binary compatibility when you update
libraries with lots of in-lined code.

But yes, seriously. Where else would you put them.

[snip]

>
> c. What debugger do you recommend?
> I am on Ubuntu Linux.
gdb :)

rlc
--
Ronald Landheer-Cieslak
Software Development Professional
http://landheer-cieslak.com
http://vlinder.ca

--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: Ulrich Eckhardt on
Pavel R. wrote:
> a. "It is guaranteed that any functions whose body is written in the
> interface is inline." Seriously?

[Note: I'm assuming C++ here!]

What is 'interface'? If you mean a header file, the answer is no. If you
mean a class definition, then the answer is yes.

Not everything in C++ starts with "class ..."!

Uli

From: DavidW on
Ulrich Eckhardt wrote:
> Pavel R. wrote:
>> a. "It is guaranteed that any functions whose body is written in the
>> interface is inline." Seriously?
>
> [Note: I'm assuming C++ here!]
>
> What is 'interface'? If you mean a header file, the answer is no. If
> you mean a class definition, then the answer is yes.

With the proviso that it doesn't necessarily end up inline in the generated
code. It is simply treated as though the body were outside the class definition
and declared 'inline'.