"DPfan" <DPfan@yahoo.com> wrote in message
news:pmVmb.15545$Ec1.1412769@bgtnsc05-news.ops.worldnet.att.net...[color=blue]
> When Stroustrup talking about C++ as a better C, he
> mentioned two points:
>
> 1. Inline functions in C++ are better than macros in C.
> 2. Easier pass-by-reference (and the avoidance of the familiar
> invalid pointer argument).
>
> Why inline functions are comparative to macros here?[/color]
Because C programmers commonly wrote macros for code
that was expected to be called many times. Since C does
not have inline functions (or does it now?), that was the fastest
way to write such code. Consider min(), for instance.
[color=blue]
> Why pass-by-reference is easy in C++?[/color]
Because there is a builtin reference type that doesn't require
you to dereference anything.
[color=blue]
> What does it mean by "avoidance of the familiar invalid
> pointer argument"?[/color]
If you write a function that takes an argument by pointer, and
expects that pointer to be valid, if a user passes a null pointer,
the function has to handle that code specially.
Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003