0

In VS2015 is there an equivalent flag of GCC -fpermissive? That's for a cpp application Thanks S.

simalps
  • 3
  • 1
  • 7
  • 2
    I hope not, `-fpermissive` is a terrible idea. The scope of changes it introduces over non-permissive mode is too big and can't be controlled easily. – milleniumbug Mar 20 '16 at 20:34
  • What specific issue are you trying to work around? – milleniumbug Mar 20 '16 at 20:35
  • 2
    So, essentially, an option along the lines of *"Treat errors as warnings"*? No, this does not exist. If you have non-conforming code, just fix the code. Don't tell the compiler to shut up so that you can ship buggy code to customers. – IInspectable Mar 20 '16 at 20:42
  • The workaround has a reason (as always): I have an high level source code which is translated into C or C++. My particular problem is that when I have a value `unsigned int *` which is passed to a function that expects an `int *`. So in GCC I can use -fpermissive, with VS I cannot build the program. Of course I know that this is a buggy code. This come from a big collaborative project... Fixes like that will (must) be solved in a next step. – simalps Mar 22 '16 at 07:15
  • @simalps: "Fixes like that will (must) be solved in a next step" - and I felt a great disturbance in the Force, as if millions of voices suddenly cried out in terror at the increased technical debt in the Universe, and then were silenced :-) – paxdiablo Aug 09 '18 at 04:27
  • @paxdiablo :) exactly. this is a quote i’ll print stick in somewhere, definitely – simalps Aug 17 '18 at 20:13

2 Answers2

1

The theoretical equivalent is /Ze.

However, this allows Microsoft-specific extensions, whereas -fpermissive allows GCC-specific extensions. If you want your code to be portable, write portable code. It's that simple.

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • /Ze in VS2017 with MSVC 19 gives me "cl : Command line warning D9035 : option 'Ze' has been deprecated and will be removed in a future release" – parsley72 Oct 03 '17 at 02:04
  • @parsley72: Good to hear. – MSalters Oct 03 '17 at 07:57
  • @parsley72: I rolled back your change. `-fpermissive` is the GCC switch, as mentioned in the question. It's not at all the same as `/permissive-` in VS2017. For starters, it has the opposite meaning. – MSalters Oct 03 '17 at 08:45
1

VC++ compiler permissive by default, but you can disable it using compiler flag /permissive- starting with VS2015 Update 3

KindDragon
  • 6,558
  • 4
  • 47
  • 75
  • `/permissive-` is being extended in VS2017 https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/ – parsley72 Oct 03 '17 at 15:49
  • I *have* vs2k15u3 but, when I enter `/permissive-` into the "Project properties | C/C++ | Command Line | Aditional Options" field, I get: `2>cl : Command line warning D9002: ignoring unknown option '/permissive-'` – paxdiablo Aug 08 '18 at 00:26
  • @paxdiablo What exact version do you use? –  Aug 08 '18 at 11:37
  • @Pi: fron the vs2k15pro help/about: Version 14.0.25431.01 Update 3. – paxdiablo Aug 09 '18 at 04:20