D
dmoos AT esigma-systems DOT de
Hopefully somebody could teach me, what coding is correct,
clean and preferable:
#include <string>
int main(int argc, char **argv) {
std::string str = "lala";
char *cp = "lala";
return (cp == str) ? 0 : 1;
}
Is this code-snippet correct and ANSI-conform or should i
convert/copy/assign the content of cp into a string before
comparing to str?
All comments, hints and critics are highly appreciated.
Thanks in advance,
Darius.
clean and preferable:
#include <string>
int main(int argc, char **argv) {
std::string str = "lala";
char *cp = "lala";
return (cp == str) ? 0 : 1;
}
Is this code-snippet correct and ANSI-conform or should i
convert/copy/assign the content of cp into a string before
comparing to str?
All comments, hints and critics are highly appreciated.
Thanks in advance,
Darius.