Closed Nicholaswogan closed 1 year ago
Compiling hitran.cpp with clang++ instead of GNU g++ produces different results. The cause has to do with this line here: https://github.com/exoclime/HELIOS-K/blob/8e768db9d700e731af21bc22090a2f04e6dd9b94/hitran.cpp#L116
hitran.cpp
When I compile with GNU g++ with the warnings flag enabled, I get
(petit) nicholas@Nicholass-MacBook-Air-6 HELIOS-K % /opt/homebrew/bin/g++-12 hitran.cpp -o hitran -Wall hitran.cpp: In function 'int main(int, char**)': hitran.cpp:90:14: warning: unused variable 'c' [-Wunused-variable] 90 | char c[4]; | ^ hitran.cpp:96:14: warning: unused variable 'skip' [-Wunused-variable] 96 | char skip[4]; | ^~~~ hitran.cpp:116:32: warning: '%s' directive writing up to 3 bytes into a region of size 1 [-Wformat-overflow=] 116 | sprintf(iiso, "%s", &iii[2]); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~ hitran.cpp:116:24: note: 'sprintf' output between 1 and 4 bytes into a destination of size 1 116 | sprintf(iiso, "%s", &iii[2]);
Hi Nick, I fixed that line in the code, and the warning message is gone. Could you try again to compile and run it with glang++?
The new hitran.cpp seems to work with clang++
Compiling
hitran.cpp
with clang++ instead of GNU g++ produces different results. The cause has to do with this line here: https://github.com/exoclime/HELIOS-K/blob/8e768db9d700e731af21bc22090a2f04e6dd9b94/hitran.cpp#L116When I compile with GNU g++ with the warnings flag enabled, I get