Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!att!watmath!watserv1!pdevries From: pdevries@watserv1.waterloo.edu (Peter DeVries) Newsgroups: comp.lang.c++ Subject: char * operator Keywords: string, c prototypes Message-ID: <1990May8.142721.10202@watserv1.waterloo.edu> Date: 8 May 90 14:27:21 GMT Distribution: comp Organization: University of Waterloo Lines: 32 Continuing on the topic of what to return from a string classes char * operator. We have defined the function as 'const char * operator char *(void);' to attempt to avoid someone using the returned string and killing it. Unfortunately, when we use it in a C funtion declared as myFunc(char *arg1, char *arg2); main() { String s1("hello"); myFunc("arg1",s1); } the compiler (zortech 2.06?). does not issue any type of error message. Is this correct? We were hoping it would complain about passing a const char * where it wanted a char *, and thus notify the programmer that they need to create a temporary variable... p. -- Peter DeVries Mutual Life of Canada c/o pdevries@watserv1.waterloo.edu (519) 888-3523