Re: when to use C and when to use C++
- From: Frederick Gotham <fgothamNO@xxxxxxxx>
- Date: Fri, 17 Nov 2006 18:54:01 GMT
Keith Thompson:
And we'd probably end up with something like C++...
C++ has the same array/pointer conversion rules as C (though it also
has STL vectors and so forth).
<OT>
Yes, but we can have references to arrays, and we can pass an array by
reference.
void Func(int (&arr)[5]) {}
Or more exotically:
#include <cstddef>
void Func(int *p,std::size_t len) {}
template<std::size_t len>
void Func(int (&arr)[len]) { Func(arr,len); }
int main()
{
int arr[5];
Func(arr);
}
</OT>
--
Frederick Gotham
.
- References:
- when to use C and when to use C++
- From: sam_cit
- Re: when to use C and when to use C++
- From: jacob navia
- Re: when to use C and when to use C++
- From: Frederick Gotham
- Re: when to use C and when to use C++
- From: jacob navia
- Re: when to use C and when to use C++
- From: Frederick Gotham
- Re: when to use C and when to use C++
- From: jacob navia
- Re: when to use C and when to use C++
- From: Richard Heathfield
- Re: when to use C and when to use C++
- From: jacob navia
- Re: when to use C and when to use C++
- From: Frederick Gotham
- Re: when to use C and when to use C++
- From: jacob navia
- Re: when to use C and when to use C++
- From: Keith Thompson
- Re: when to use C and when to use C++
- From: jacob navia
- Re: when to use C and when to use C++
- From: Frederick Gotham
- Re: when to use C and when to use C++
- From: Keith Thompson
- when to use C and when to use C++
- Prev by Date: Re: Object-oriented programming in standard ANSI C
- Next by Date: Re: can "if (ptr)" cause problems?
- Previous by thread: Re: when to use C and when to use C++
- Next by thread: Re: when to use C and when to use C++
- Index(es):
Relevant Pages
|