Re: char* pname = "Harry"



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.
.



Relevant Pages

  • Re: Error in CString
    ... real fix is to change your char * to TCHAR *. ... and I got bunch of error during linking with ... lib files, as I traced the linked libraries I found out that, some of ...
    (microsoft.public.vc.mfc)
  • Re: Char Styles
    ... I've tried this one - doesn't do anything (maybe because it's not linking to ... Char Char, MWbody Char Char, etc. etc. ... That macro locks up my document and I end up ... Doug Robbins - Word MVP, ...
    (microsoft.public.word.vba.general)
  • Re: Address of function from shared library
    ... linking. ... char buf; ... Placing AESEncrypt inside libcrypto, ...
    (comp.unix.programmer)