gnudatalanguage / gdl

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

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

Closed GillesDuvert closed 3 months ago

GillesDuvert commented 3 months 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 3 months 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