Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 BUG: "Add Include" is using backslashes
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

MrDoomMaster
Tomato Guru

251 Posts

Posted - Oct 28 2015 :  08:53:24 AM  Show Profile  Reply with Quote
In C++ you should use forward slashes, like so:

#include "Subdir/MyHeader.hpp"

Instead, "Add Include" feature is adding it like this:

#include "Subdir\\MyHeader.hpp"

This is incorrect.

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Oct 28 2015 :  3:56:27 PM  Show Profile  Reply with Quote
Personally I have never been quite sure which slash you were supposed to use in #include lines, partly due to coming from a Unix background. There is a setting to tell VA which slash to use, which is explained here:

http://docs.wholetomato.com/default.asp?W337

By default, VA uses the slash that you are already using in the current file, to be consistent. So the setting is most useful when there are no existing #include statements to follow.

zen is the art of being at one with the two'ness
Go to Top of Page

MrDoomMaster
Tomato Guru

251 Posts

Posted - Oct 28 2015 :  4:37:22 PM  Show Profile  Reply with Quote
In this particular case, the file had no current include directives, so I guess it defaulted to backslash.

IMHO this should not be a configurable option because the C++ standard states using backslash is undefined behavior:

http://stackoverflow.com/questions/5790161/is-the-backslash-acceptable-in-c-and-c-include-directives
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Oct 28 2015 :  6:10:53 PM  Show Profile  Reply with Quote
Interesting, learn something new every day. That is clear, but the IDE its self makes this an option in VS2010 and above. We have users who specifically want to use forward slash or back slash in their #include statements. Probably related to the main OS they are targeting. So from a support perspective, some code bases are quite set in their ways about which slash to use.

Hopefully now you have set this, VA is working as desired for you?

zen is the art of being at one with the two'ness
Go to Top of Page

MrDoomMaster
Tomato Guru

251 Posts

Posted - Oct 28 2015 :  6:17:28 PM  Show Profile  Reply with Quote
All toolchains support forward slash, regardless of platform. I'm under the humble opinion that by supporting backslash, the tooling is allowing "illegal" behavior.

Just because someone else is doing it wrong (i.e. VS offering the configuration, as you assert) doesn't mean you have to. Microsoft certainly does not have a reputation as standards compliant. If anyone complains about the lack of configurability, you can simply mention that forward slash is the way to do it.

Those that argue for backslash will be uneducated on these details we've covered. Most will assume since you're on Windows, include directives must also use back slashes. It's a common misconception.

Regardless, it wasn't my goal to come here to ask for features to be removed. At least this is configurable, so I can choose the correct configuration for my needs. The only outstanding recommendation is that you guys use forward-slash as the default, instead of backslash. That is arguably the most important issue here -- you certainly don't want to teach people the wrong way.

Edited by - MrDoomMaster on Oct 28 2015 6:20:01 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Oct 29 2015 :  11:48:43 PM  Show Profile  Reply with Quote
That makes sense, I have put in a bug report for this:

case=93033

However, since we follow the IDE setting when it exists, this won't make a great deal of difference until / unless Microsoft change the default in the IDE.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000