<html><head></head><body><div>Although I am not the adressee of the question, mu 2/100€:</div><div><br></div><div>memset to zero makes only sense on POD-types (c-compatible layout). Those have trivial copy-assignment (bitwise-copyable). String is not a POD type (unlike char*), as it contains opaque internal data (like length, pointer to the buffer, maybe more) and thus setting it to 0 will not do anything useful.</div><div><br></div><div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>my question: can i replace the two lines above with:</pre><pre><br></pre><pre>ItemMultipleDuplicateData mdData{};</pre></blockquote><div><div>No. Unless you provide default constructor which will set to zero all POD-types contained in the struct (non-POD types like strings will be initialized using their default ctors), and then you can omit the "{}" as well (If you upgraded to c++11, you can put (POD and non-POD) initilizers inline). In that case, you can also delete the memset(...) because that will have been done by the ctor already. </div><div><br></div><div>Like this:</div><div><br></div><div>struct ItemMultipleDuplicateData</div><div>{</div><div>        // default ctor</div><div>        ItemMultipleDuplicateData(): type(0),copyCount(0),copyShiftOrGap(0),copyShiftGapH(0),...{};</div><div>   int type;</div><div>        int copyCount;</div><div>   int copyShiftOrGap;</div><div>      double copyShiftGapH;</div><div>    double copyShiftGapV;</div><div>    double copyRotation;</div><div>     int gridRows;</div><div>    int gridCols;</div><div>    double gridGapH;</div><div> double gridGapV;</div><div>};</div><div></div><div><br></div><div>or like this (c++11):</div><div><br></div><div><div>struct ItemMultipleDuplicateData</div><div>{</div><div> int type=0;</div><div>      int copyCount=0;</div><div> int copyShiftOrGap=0;</div><div>    double copyShiftGapH=0.;</div><div> double copyShiftGapV=0.;</div><div> double copyRotation=0.;</div><div>  int gridRows=0;</div><div>  int gridCols=0;</div><div>  double gridGapH=0.;</div><div>      double gridGapV=0.;</div><div>};</div><div></div></div><div><br></div><div><br></div><div>Cheers, v.</div><pre><br></pre></div></div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>hi jean and craig</pre><pre><br></pre><pre>i have a question to you:</pre><pre><br></pre><pre>in scribusMainWindow::duplicateItem() mdData is</pre><pre>initialized through a memset():</pre><pre><br></pre><pre>ItemMultipleDuplicateData mdData;</pre><pre>memset(&mdData, 0, sizeof(mdData));</pre><pre><br></pre><pre><a href="https://github.com/scribusproject/scribus/blob/master/scribus/scribus.cpp#L6431">https://github.com/scribusproject/scribus/blob/master/scribus/scribus.cpp#L6431</a></pre><pre><br></pre><pre>on the one side, usertaskstructs.h does not seem to be explicitly</pre><pre>imported which is a bit odd to me.</pre><pre><br></pre><pre>on the other side, for the extension to multiple duplicate i've</pre><pre>programmed (and which i will present very soon: yeah!) i needed to add</pre><pre>a string to ItemMultipleDuplicateData and now memset() does not work any</pre><pre>more and gives me the error:</pre><pre><br></pre><pre>/home/ale/src/scribus-github/scribus/scribus.cpp: In member function</pre><pre>‘void Scri busMainWindow::duplicateItem()’:</pre><pre>/home/ale/src/scribus-github/scribus/scribus.cpp:6438:35: warning:</pre><pre>‘void* memse t(void*, int, size_t)’ clearing an object of type ‘struct</pre><pre>ItemMultipleDuplicate Data’ with no trivial copy-assignment; use</pre><pre>assignment or value-initialization i nstead [-Wclass-memaccess]</pre><pre>  memset(&mdData, 0, sizeof(mdData));</pre><pre><br></pre><pre>?</pre><pre><br></pre><pre>in my eyes, it does the same... but i don't know much about memset()...</pre><pre><br></pre><pre>ciao</pre><pre>a.l.e</pre><pre><br></pre><pre>___</pre><pre>Scribus Mailing List: <a href="mailto:scribus@lists.scribus.net">scribus@lists.scribus.net</a></pre><pre>Edit your options or unsubscribe:</pre><pre><a href="http://lists.scribus.net/mailman/listinfo/scribus">http://lists.scribus.net/mailman/listinfo/scribus</a></pre><pre>See also:</pre><pre><a href="http://wiki.scribus.net">http://wiki.scribus.net</a></pre><pre><a href="http://forums.scribus.net">http://forums.scribus.net</a></pre></blockquote></body></html>