Re: char* pname = "Harry"
- From: Martin Ambuhl <mambuhl@xxxxxxxxxxxxx>
- Date: Tue, 18 Apr 2006 16:24:18 GMT
peter.koch.larsen@xxxxxxxxx wrote:
John Bode wrote:
erktek@xxxxxxxxx wrote:
Statement given below;
char * p ;
p = (char*) malloc(20);
Lose the cast, unless you're working with a *very* old implementation
(pre-C89).
[snip]
Or the code should be usable with both C and C++.
Continuing with your off-topic statement, for which there is no excuse.
Idiomatic C Code is "usable with both C and C++." C++ has defined methods for linking C code written without regard to C++ arcane requirements, so there is never a reason to pervert the normal C idiom to "be usable with both C and C++." I thought we lost the trolls that kept beating this horse.
.
- Follow-Ups:
- Re: char* pname = "Harry"
- From: Keith Thompson
- Re: char* pname = "Harry"
- References:
- char* pname = "Harry"
- From: erktek
- Re: char* pname = "Harry"
- From: John Bode
- Re: char* pname = "Harry"
- From: peter . koch . larsen
- char* pname = "Harry"
- Prev by Date: Re: Different code behaviour in Unix & Windows
- Next by Date: Re: && and || -- precedence evaluation doubt
- Previous by thread: Re: char* pname = "Harry"
- Next by thread: Re: char* pname = "Harry"
- Index(es):
Relevant Pages
|