Re: return const and assert

From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 02/20/04


Date: Fri, 20 Feb 2004 02:49:30 GMT


"alexhong2001" <alexhong2001@hotmail.com> wrote...
> When to return a const, from either a member function of a class or
> non-member?

When returning by value, 'const' really isn't of any use. It's
basically like adding 'const' when passing by value: means almost
nothing.

> Is assert() only executed in debug mode but skipped in release mode?

Using your terminology, yes.

> I
> don't see much usage of "assert()." Am I missing its importance?

Probably. 'assert' is a debugging tool for code where you don't
want to have a run-time check once you cleaned everything up.

V