I have a C program that tries to modify a const string literal. As now I learned that this is not allowed.
When I compile the code with clang test.c
the compiler gives no warning. But when I compile it with clang++ test.c
it gives a warning:
test.c:6:15: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings] char *s = "hello world"; ^
The problem is that it turns out clang++
is just a symbol link of clang
:
ll `which clang++`
lrwxr-xr-x 1 root admin 5 Jan 1 12:34 /usr/bin/clang++@ -> clang
So my question is how could clang++
behaves differently from clang
given that it's a symbol link of clang
?
argv[0]
and altering the behavior? So it's hard coded in bash thatclang++
behaves differently fromclang
? – Anomaly