Author Topic: c++ parser  (Read 4611 times)

lechoo

  • Guest
c++ parser
« on: February 28, 2007, 03:49:11 pm »
Hello
I have problem with parser.
When I write

WNDCLASSEX wincl;

and want use

wincl.

it should show teh members of this struct, but id don't show ;/

Sorry for my english

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: c++ parser
« Reply #1 on: February 28, 2007, 07:34:21 pm »
Codecompletion pugin doesn't support structs currently, sorry :(.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: c++ parser
« Reply #2 on: February 28, 2007, 07:43:33 pm »
Codecompletion pugin doesn't support structs currently, sorry :(.
That's not true. structs are very well supported, if you define them like:
Code
struct tMyStruct
{
  int MyInt;
  double dMyDouble;
  bool MyBool;
};
typedef struct tMyStruct tMyStruct;
tMyStruct. will then perfectly code-complete. If you can do the same with WNDCLASSEX (not sure about that) It'll work, too.

With regards, Morten

Ps.: BTW: lechoo: This poll is non-sense. Why did you choose to create such a poll instead of a normal post?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: c++ parser
« Reply #3 on: February 28, 2007, 08:41:49 pm »
If you write
Code
struct tMyStruct_
{
  int MyInt;
  double dMyDouble;
  bool MyBool;
};
typedef struct tMyStruct_ tMyStruct;

Code
tMyStruct s;
s.
won't be completed. Same with
Code
struct tMyStruct_ s;
s.

What will be completed is
Code
tMyStruct_ s;
s.
although I think it isn't valid c++ (I just tried it and gcc compiled without errors/warnings :shock:)
For the windows-structs it isn't that easy, since they are defines either for the -A or for the -W version (e.g. WNDCLASSEXA) (depending whether you are using unicode).
Code: winuser.h
#ifdef UNICODE
#define EDITWORDBREAKPROC EDITWORDBREAKPROCW
...
typedef WNDCLASSW WNDCLASS,*LPWNDCLASS,*PWNDCLASS;

Anyway, I'm glad that codecompletion does work for structs. I'm going to change my structs, wich are happily not that many :D

Greetings raph

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: c++ parser
« Reply #4 on: February 28, 2007, 08:57:42 pm »
although I think it isn't valid c++
It is valid C++; in C++ a struct is identical to a class, with the exception of the default member access being public instead of private.

C++ may use this idiom:
Code
struct mystruct
{
    ...
};
...
mystruct s;
but C must use an idiom such as this:
Code
typedef struct mystruct_
{
    ...
} mystruct;
...
mystruct s;
or this:
Code
struct mystruct
{
    ...
};
typedef struct mystruct mystructdef;
...
struct mystruct s;
mystructdef s;
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline raph

  • Almost regular
  • **
  • Posts: 242
Re: c++ parser
« Reply #5 on: February 28, 2007, 09:25:40 pm »
Ah thanks, that explains my confusion  :)