Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Intellisense Bug with unsigned char (Read 3240 times)
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Intellisense Bug with unsigned char
Feb 9th, 2018 at 8:14pm
Print Post  
Hi!
I found another small bug in intellisense.

Probably applies to all IDE and VS versions, but just for info im using:

Arduino 1.8.5, (GCC) 4.9.2, Visual Studio 15.5.5 with Release 1801.27 of Visual Micro

In "normal" C++ on windows and on linux, uint8_t is a 1 byte value defined as an unsigned char. Creating a regular C++ project in visual studio, any version, will give the correct result when hovering over the define of uint8_t.
Unfortunately Intellisense on Visual Micro is reporting unit8_t as an unsigned int, which is wrong.

Here is some simple code (Header.h contains just the typedef for uChar, shown in the comment where used):

Code (C++)
Select All

#include "Header.h"

unsigned char test1[] = { 0xFF, 0x00 };
uChar         test2[] = { 0xFF, 0x00 }; // typedef uint8_t uChar;
uint8_t       test3[] = { 0xFF, 0x00 };

void testUnsignedChar(uint8_t *cString)
{
    cString[0]++;
}

void setup()
{
    testUnsignedChar(test1);
    testUnsignedChar(test2);
    testUnsignedChar(test3);
}

void loop()
{
    delay(1000);
}


 



As expected it compiles fine without warnings and works, but Intellisense is reporting an error as in the screenshot bellow  Cry
« Last Edit: Feb 9th, 2018 at 8:14pm by Johnex™ »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense Bug with unsigned char
Reply #1 - Feb 9th, 2018 at 8:52pm
Print Post  
I think it's because unsigned char is defined by underlying gcc sources that are in files that are not declared in sparkfun/avr build instructions so they are difficult for visual micro to find them.

There is an enhancement due shortly that will attempt to feed more of the results from the last build into intellisense

A workaround is to add a header to the project that can be used to override intellisense.

Code (C++)
Select All
#pragma once

#if defined(_MSC_VER)

   typedef unsigned char uint8_t;
   //insert more dummy defs here

#endif 




or

Code (C++)
Select All
#pragma once

#if defined(_VMICRO_INTELLISENSE)
   typedef unsigned char uint8_t;
   //insert more dummy defs here
#endif

 


« Last Edit: Feb 9th, 2018 at 8:54pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Re: Intellisense Bug with unsigned char
Reply #2 - Feb 9th, 2018 at 9:08pm
Print Post  
Yeah but that is a sad fix, there shouldn't have to be any modifications coming from the stock Arduino to Visual Micro at all Cheesy.
« Last Edit: Feb 9th, 2018 at 9:13pm by Johnex™ »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense Bug with unsigned char
Reply #3 - Feb 9th, 2018 at 9:31pm
Print Post  
Visual Micro adds quite a few intellisense overrides for some boards. Visual Studio is windows c++ not gcc so if we want to use a standard visual studio c++ project we have to make some allowances.

It's something that is constantly improved but will never be perfect.

The link to the extended intellisense is also at the top of the vm home page and visual micro also works in atmel studio which is gcc aware.
  
Back to top
WWW  
IP Logged
 
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Re: Intellisense Bug with unsigned char
Reply #4 - Feb 9th, 2018 at 10:54pm
Print Post  
From what i understand you want the transition from Arduino IDE to Visual Micro to be seamless no?

And sure, Visual Micro does lots of overrides its expected, but the user shouldn't need to do anything.

Also, i tested with all AVR boards and its the same issue, so any user coming from Arduino with their projects will have the same warnings.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense Bug with unsigned char
Reply #5 - Feb 9th, 2018 at 11:34pm
Print Post  
Yes it's a problem for me especially because some users don't realize that intellisense is VS and the build is Visual Micro.

VS isn't ideal for this, atmel studio is better in this area but not in other areas. So you have to take your pick.

It is possible for visual micro to use slightly different project types in VS2017 which does have some extra capabilities on top of other IDE's but with most users using for free it's difficult for me to justify the time.

Hopefully soon.
  
Back to top
WWW  
IP Logged
 
Johnex™
Junior Member
**
Offline


Posts: 10
Joined: Feb 2nd, 2018
Re: Intellisense Bug with unsigned char
Reply #6 - Feb 10th, 2018 at 10:23am
Print Post  
Yeah it's not priority ofc, just have it on your mind Cheesy
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense Bug with unsigned char
Reply #7 - Feb 10th, 2018 at 1:55pm
Print Post  
It's been on my mind for 8 years and 20,000 forum threads  Smiley

Thanks, it's a good one to add
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint