Code::Blocks Forums

User forums => Help => Topic started by: rldml on June 22, 2016, 09:03:00 pm

Title: SmartSense C++11-Features
Post by: rldml on June 22, 2016, 09:03:00 pm
Hello there,

 a short search in this forum didn't bring any results, so i try it to write a new post.

Is there an option to configure SmartSense to recognize C++11-Code?

This is my example code:
File: vehikel.h

#ifndef __CLASS_VEHIKEL__
#define __CLASS_VEHIKEL__

#include <string>

class Vehikel
{
    private: unsigned int maxGeschwindigkeit;
    private: unsigned int anzahlReifen;
    private: std::string typ;

    public: Vehikel();
    public: Vehikel(unsigned int maxGeschwindigkeit, unsigned int anzahlReifen, std::string typ);
    public: std::string GetTyp();
};

#endif // __CLASS_VEHIKEL__

File: vehikel.cpp:

#include "vehikel.h"

Vehikel::Vehikel()
{
    this->typ = "Auto";
    this->maxGeschwindigkeit = 110;
    this->anzahlReifen = 4;
}

Vehikel::Vehikel(unsigned int maxGeschwindigkeit, unsigned int anzahlReifen, std::string typ)
{
    this->typ = typ;
    this->anzahlReifen = anzahlReifen;
    this->maxGeschwindigkeit = maxGeschwindigkeit;
}

std::string Vehikel::GetTyp()
{
    return this->typ;
}

File: main.cpp:

#include <iostream>
#include "vehikel.h"

using namespace std;

int main()
{
    Vehikel Car();
    string bla = Car.GetTyp();
    cout << bla << endl;
    return 0;
}

If i change the line "Vehikel Car();" to "Vehikel Car{};" (C++11-Standard), retype the line under that, SmartSense will not detect Car as a valid object and don't offer me any options.

It's my pleasure to use the new intialization-type, but i don't want to miss SmartSense. Is there a way to combine both things?

edit: same to this->... :(

Greetz, Ronny
Title: Re: SmartSense C++11-Features
Post by: oBFusCATed on June 23, 2016, 08:21:16 am
No, there is no setting, because the support in the parser for c++11 is missing.
Title: Re: SmartSense C++11-Features
Post by: rldml on June 23, 2016, 08:51:15 am
Thank you for reply =D.

So, i have to adjust my coding-behavior until i am good enough to add this feature by myself if possible... Is this plugin Open Source too?

Greetz, Ronny
Title: Re: SmartSense C++11-Features
Post by: oBFusCATed on June 23, 2016, 09:35:38 am
Yes it is. Also there is the clang based codecompletion plugin available on github.
Title: Re: SmartSense C++11-Features
Post by: ollydbg on June 25, 2016, 09:22:28 am
Some reported bugs.
See:
Code::Blocks / Tickets / #33 C++11 Initializer lists fool code completion (https://sourceforge.net/p/codeblocks/tickets/33/)
and
Re: C++11 code completion (CC) doesn't work with list-initialization (http://forums.codeblocks.org/index.php/topic,19522.msg140431.html#msg140431)