Not sure about VC - but fresh enough (at least 8.x) gcc often produces the following warning (exact reason certainly differs):

/usr/home/firebird/B3_0_Release/src/jrd/trace/../../jrd/trace/../../dsql/../jrd/val.h:154:39: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct Jrd::impure_value’; use assignment or value-initialization instead [-Wclass-memaccess]
    memset(&*impure, 0, sizeof(*impure));

In master it's turned off using gcc switch, but in 3.0 - one can easily see it.

I think that using switches to turn off warnings is not best practice (warnings in general are useful) and should be used only when there is no better solution. For this particular case the following solution may be used instead:
    memset((void*)&*impure, 0, sizeof(*impure));
i.e. explicit C-cast. It's absolutely safe cause it's anyway done when callin mem* functions.

Do you agree it's better approach? If nobody agrues against I'm going to perform sources review in the middle of next week.




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to