gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
274 stars 61 forks source link

silence pointer arithmetic warning issued for !GDL.RELEASE string trim #1872

Closed GillesDuvert closed 3 weeks ago

GillesDuvert commented 1 month ago

Compilation produces

initsysvar.cpp:659:58: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] gdlStruct->NewTag("RELEASE", new DStringGDL( VERSION + (VERSION[0] == 'v' ? 1 : 0)));

I do not see the point of doing this, so I leave it as it is....

slayoo commented 1 month ago

Thanks @GillesDuvert for reporting. I've introduced it here: https://github.com/gnudatalanguage/gdl/pull/1780 The idea is to strip the leading "v" in the C string (char*) VERSION by adding one to the pointer. git describe returns the tag name which in most cases starts with "v" (like v1.0.0), but we expect !GDL.RELEASE to be 1.0.1