T O P I C R E V I E W |
MrDoomMaster |
Posted - Oct 28 2015 : 08:53:24 AM 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. |
5 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Oct 29 2015 : 11:48:43 PM 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. |
MrDoomMaster |
Posted - Oct 28 2015 : 6:17:28 PM 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. |
feline |
Posted - Oct 28 2015 : 6:10:53 PM 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? |
MrDoomMaster |
Posted - Oct 28 2015 : 4:37:22 PM 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 |
feline |
Posted - Oct 28 2015 : 3:56:27 PM 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. |
|
|