Robert Ryan <[EMAIL PROTECTED]> wrote:
>
> 1. if a function does not return a value, the last line
> executed is: return; is this right,

The following won't compile under C99 or C++...

  int foo() { return; }

C++ requires that non void functions return a value.
C only requires non void functions to return a value if
the caller attempts to use the return value.

> because isn't the purpose of a function to return a
> value

What value does the following function return...?

  void bar() { }

> 2. another question: misspelling 'sqrt' would result in
> a compile time error or a linker error

Depends on the misspelling. 

>                        I would think a compile time
> error

C90 will assume an implicit function declaration for
a call to an undeclared named function. In such cases,
it's possible for a link error, or worse, no reported
error.

> 3. vector<int> v(6) means each int is initialized to 6

Ask yourself: if 6 is the value to initialise the ints
with, how many ints are initialised?

> 4. does a narrow_cast check for information that is lost

Depends on whoever's 'narrow_cast' you're using.

> 5. is the purpose of a grammar is to generate
> syntactically correct expressions

  http://en.wikipedia.org/wiki/Formal_grammar

> 6. streams may be input, output or both
> 7. in the C++ statement: int& r = i; memory is
> allocated for i, but not for r

The declaration says nothing about the allocation
for i. The virtual C and C++ machines will allocate
storage for r. An optimiser may be able to remove
the need for actual memory allocation.

-- 
Peter

Reply via email to