[scribus] a development question on initializing ItemMultipleDuplicateData

ale rimoldi ale.comp_06 at xox.ch
Mon Sep 10 09:32:45 UTC 2018


hi jean and craig

i have a question to you:

in scribusMainWindow::duplicateItem() mdData is
initialized through a memset():

ItemMultipleDuplicateData mdData;
memset(&mdData, 0, sizeof(mdData));

https://github.com/scribusproject/scribus/blob/master/scribus/scribus.cpp#L6431

on the one side, usertaskstructs.h does not seem to be explicitly
imported which is a bit odd to me.

on the other side, for the extension to multiple duplicate i've
programmed (and which i will present very soon: yeah!) i needed to add
a string to ItemMultipleDuplicateData and now memset() does not work any
more and gives me the error:

/home/ale/src/scribus-github/scribus/scribus.cpp: In member function
‘void Scri busMainWindow::duplicateItem()’:
/home/ale/src/scribus-github/scribus/scribus.cpp:6438:35: warning:
‘void* memse t(void*, int, size_t)’ clearing an object of type ‘struct
ItemMultipleDuplicate Data’ with no trivial copy-assignment; use
assignment or value-initialization i nstead [-Wclass-memaccess]
  memset(&mdData, 0, sizeof(mdData));

my question: can i replace the two lines above with:

ItemMultipleDuplicateData mdData{};

?

in my eyes, it does the same... but i don't know much about memset()...

ciao
a.l.e



More information about the scribus mailing list