pdevries@watserv1.waterloo.edu (Peter DeVries) (05/08/90)
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