Visual Studio Ide for Arduino
https://www.visualmicro.com/forums/YaBB.pl
>> >> Intellisense problem with function overloading
https://www.visualmicro.com/forums/YaBB.pl?num=1555313476

Message started by Bjorn Moren on Apr 15th, 2019 at 8:31am

Title: Intellisense problem with function overloading
Post by Bjorn Moren on Apr 15th, 2019 at 8:31am
Hi Visual Micro community! First I want to compliment the makers of Visual Micro. It makes Arduino development so much easier. My only wish is for a better debugger, where I can hover over variables and see their values in real time as I single step through the code.

However, intellisense seems to be a persistent problem, and it can get a bit annoying. Through trial and error, I have learned that it can take a while for the intellisense to catch up, a simple recompile won't always do the trick. Take a one minute break, come back, and there might not be a problem anymore. Still, it is frustrating, because a code that compiles fine shouldn't have any intellisense errors.

Here is a minor intellisense problem that won't go away though. It looks like intellisense can't pick the correct overloaded function when they are listed in a certain order. See code below, and also the attached screen shot.


Code (c++):
class TestClass
{
public:
     void add(const __FlashStringHelper *str) { };                        // This won't work
     void add(const char *str) { };
     void add(uint8_t n) { };
     void add(int8_t n) { };
     void add(int32_t n) { };

     //void add(uint8_t n) { };                                                      // But this will
     //void add(int8_t n) { };
     //void add(int32_t n) { };
     //void add(const __FlashStringHelper *str) { };
     //void add(const char *str) { };

     inline void  operator << (const __FlashStringHelper *str) { return add(str); }       // Intellisense error here
     inline void  operator << (const char *str) { return add(str); }       // Intellisense error here
     inline void  operator << (int32_t value) { return add(value); }
     inline void  operator << (uint8_t value) { return add(value); }
     inline void  operator << (int8_t value) { return add(value); }
};




Untitled-1_002.jpg (154 KB | 6 )

Title: Re: Intellisense problem with function overloading
Post by Bjorn Moren on Apr 15th, 2019 at 8:40am
Forgot to mention that I'm using Visual Micro 1903.24.2 on VS Community 2017. Compiling for Arduino Uno.

Title: Re: Intellisense problem with function overloading
Post by Visual Micro on Apr 15th, 2019 at 4:23pm
Hi,

Thanks for the post and useful info.

I suspect the intellisense issue is because the visual studio intellisense engine is not perfect with GCC. We use visual studio for intellisense but not for build. We will shortly move intellisense to using clang which should be better.

It might not help in this case but it is possible to create intellisense workarounds. This involves redefining types within a preprocessor condition that states intellisense only. It's not a great solution.

As for debugging we have an update for visual micro due for release that supports GDB. The only issue will be for an Uno GDB doesn't always work so well. The update should be available in the forum releases section over the next few days and then in the gallery in a few weeks.

The standard visual micro debugger uses serial which it has to inject into hidden temp copies of the code just prior to compile. Therefore it is difficult to give the live view you are looking for on any variable at any time but gdb will do that and in the standard visual studio debugger windows.


Title: Re: Intellisense problem with function overloading
Post by Bjorn Moren on Apr 15th, 2019 at 5:39pm
Thanks Tim!

Visual Studio Ide for Arduino » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2019. All Rights Reserved.