Page 1 of 1

code completion does not work with class bitfield

Posted: Thu Aug 08, 2013 4:09 pm
by solewalker
I tried to do some test on bitfields in class and found that bitfield members are not shown in completion box.

Image

Only Members specifying a bit field is not shown. Other members are shown as expected. If all the members are bit fielded none is shown. Code completion is perfectly fine with struct, if I change my class to a struct it works fine, only class has this problem

Code: Select all

#include <stdio.h>
class Bittest
{
public:
   unsigned int MENU : 1 ;
   unsigned int PLAY ;
};
int main (int argc, char ** argv)
{
   Bittest bittest;
   return 0;
}
I am using codelite 5.3 from git on windows7 64 bit

Re: code completion does not work with class bitfield

Posted: Thu Aug 08, 2013 6:23 pm
by eranif
Its indentical to this bug (opened by you?)

https://sourceforge.net/p/codelite/bugs/915/

Eran

Re: code completion does not work with class bitfield

Posted: Thu Aug 08, 2013 6:49 pm
by solewalker
Did not notice this bug report. Yes, this is referring to the same problem, but no, its not opened by me. What a coincident, after 5 days the bug is submitted I also noticed this ;)

Re: code completion does not work with class bitfield

Posted: Thu Aug 08, 2013 6:56 pm
by eranif
I never used bitfied before - which may explain how come codelite does not support it... I need to update the grammar to include this

Eran

Re: code completion does not work with class bitfield

Posted: Thu Aug 08, 2013 7:00 pm
by solewalker
I have used with struct but struct has no problem, its with only classes

Re: code completion does not work with class bitfield

Posted: Fri Aug 09, 2013 10:08 am
by petah
Bitfields are not generally recommended except at a very low level because of issues like not being able to pass a pointer to a single-bit variable but especially because concurrency is hard to ensure since atomic operations can't happen on less than a byte-level. Stroustrup's 4th edition of the C++ standard mentions these "caveats" serveral times (btw don't get the paperback edition whose loosely-glued pages fly out immediately, the hardcovert just came out).

-- p

Re: code completion does not work with class bitfield

Posted: Fri Aug 09, 2013 10:28 am
by solewalker
I too try to avoid them, but for games and other stuffs we have to use bools extensively, someone was using around 14/15 bools in a class for around thousands of objects, using bit fields and some careful declaration of variables he managed to save 178MB of memory. And that's worth saving. While trying bit fields myself I came across this bug in codelite.