bruns added a comment.
Although s_magic **decays** to a char*, it **is not** a char*. char[n] is a
type distinct from char*
From e.g. man strlen
char string[32] = "hello, world";
char *ptr = string;
sizeof (string)
⇒ 32
sizeof (ptr)
⇒ 4 /* (on a machine
apol added inline comments.
INLINE COMMENTS
> ora.cpp:21
> static constexpr char s_magic[] = "image/openraster";
> -static constexpr int s_magic_size = strlen(s_magic);
> +static constexpr int s_magic_size = sizeof(s_magic) - 1; // -1 to remove the
> last \0
>
Won't sizeof give the sizeof(ch
aacid closed this revision.
REPOSITORY
R287 KImageFormats
REVISION DETAIL
https://phabricator.kde.org/D20149
To: aacid, svuorela
Cc: svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns
svuorela accepted this revision.
This revision is now accepted and ready to land.
REPOSITORY
R287 KImageFormats
BRANCH
master
REVISION DETAIL
https://phabricator.kde.org/D20149
To: aacid, svuorela
Cc: svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns
aacid added subscribers: pino, apol, svuorela.
REPOSITORY
R287 KImageFormats
REVISION DETAIL
https://phabricator.kde.org/D20149
To: aacid
Cc: svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns
aacid created this revision.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
aacid requested review of this revision.
REVISION SUMMARY
Seems only gcc can do a constexpr with strlen.
This fixes the build with clang, hopefully to with MSVC?
REPOSITORY
R