# Visual Studio 2019 - c++ is it possible to suppress function overloading

**URL:** https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893
**Category:** Usage
**Created:** [June 18, 2022, 4:58pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893 "2022-06-18T16:58:03Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 18, 2022, 4:58pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/1 "2022-06-18T16:58:03Z")

</div>

Hi,

is there a way to modify VS options to suppress function overloading, i.e. suppression of duplicate functions?

thanks in advance

cua  
michael

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [June 18, 2022, 5:15pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/2 "2022-06-18T17:15:57Z")

</div>

No. Function overloading is a central feature of how C++ works as a language.

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 18, 2022, 5:29pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/3 "2022-06-18T17:29:56Z")

</div>

Thank you,

i thought it would be impossible.

Now i got the confirmation.

Thanks again.

cu  
michael

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [June 18, 2022, 9:49pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/4 "2022-06-18T21:49:06Z")

</div>

Wih C++11, [final](https://en.cppreference.com/w/cpp/language/final) specifier can be used to prevent any further overloading…

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [June 20, 2022, 5:49am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/5 "2022-06-20T05:49:30Z")

</div>

You’ve confused overloading with overriding.  
The former is an act of declaring more than one function with a given name but different parameters (or arguments, I never remember, which is which 😉 ).  
The latter is used to implement polymorphic behaviour in conjunction with `virtual`.

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 20, 2022, 3:49pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/6 "2022-06-20T15:49:51Z")

</div>

I don’t think so.  
I use several Open source projects, where new modules came with different parameter lists. The amount of Parameters changed, so the debugger switched from three parameter call to two param function within one step. And without any error!

Cu

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 22, 2022, 1:07am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/7 "2022-06-22T01:07:01Z")

</div>

It sounds like you have symbol conflicts between libraries. You should get libraries to rename their types and symbols to be namespaced instead of trying to live in the global namespace with such generic names as `Parameters`.

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 22, 2022, 3:54am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/8 "2022-06-22T03:54:30Z")

</div>

Thank you very much,

Btw. i Started programming c++ in the mid 80s on Siemens SX and MX and on DEC VAX computers. There i used to have Compilers which cried, when the Parameters did not Match. So it was easy to find the calls Not matching. Now If i have many modules it would be nice to have such a Compiler. With the present Project i found more than 10 functions where Parameters Not matching, but are called via debugger. A 3 parameter call to a function which has 2 Parameters or LEss, without Any existance of a called function with 3 parameters. This all Takes time.

Cu

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 22, 2022, 10:36am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/9 "2022-06-22T10:36:30Z")

</div>

I suspect that these compilers may have pre-dated C++ mangling setups (back when C++ was basically just a set of C macros). Now, C++ includes the argument list in the mangling, so different parameters make different symbols and no longer conflict.

If possible, a concrete example of what is causing your problem would help a lot here as I suspect a language barrier is confusing some of the description and understanding here.

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 22, 2022, 11:38am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/10 "2022-06-22T11:38:40Z")

</div>

Hi Ben,

thanks again.

I don’t have the problem to get it solved.

I looked for a tool(or perhaps a compiler option) when run, which delivers a list of functions found, which have different amount of parameters, when called.  
The work would be a bit easier.

So I have to do it manually, or I write my own function parser(it think, that would be the best way to go).

cu  
michael

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [June 22, 2022, 11:58am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/11 "2022-06-22T11:58:51Z")

</div>

You mean a compiler warning like mentioned here?:

> <https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang>

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 22, 2022, 2:48pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/12 "2022-06-22T14:48:23Z")

</div>

This would be a First step, but within VS the Compiler does Not throw Any Warnings Like that.

I think, its the best way to get it by myself via own Parser.

To do this by hand ist crazy.

Cu  
Michael

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [June 22, 2022, 10:28pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/13 "2022-06-22T22:28:41Z")

</div>

You could try with clang-tidy. VS2019 and later can include it. I only enabled some special rules, so no idea if you also can include this clang warning

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 23, 2022, 1:24am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/14 "2022-06-23T01:24:25Z")

</div>

I think there’s a lot of talking past each other here. @michaelk1 can you please provide a snippet of code that shows what you would like to detect here?

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 23, 2022, 2:37pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/15 "2022-06-23T14:37:18Z")

</div>

Give me a bit of time.

…

here we are:

just an example call function within the same module:

function header:

int my\_data(char \*comment, const char \*data, int length)  
{  
.// nothing interresting here  
.  
.  
}

called within the same module with:

```
	my_data("hello", 0, "\n", 5);

```

No compiler warning, debugger steps into “my\_data”, 4 parameters given to function, but not beeing able to get the fourth parameter. No error.

Due to the fact, the open source project will be changed time by time. But i don’t know which parts are changed. If the producer of the project will change function “my\_data” by changing the amount of arguments, it would be nice to have a list, which functions differ from the function calls, so i would be able to change the calls. you know without changing the calls, it will not be a question if the application crashes, but when.

And that will be not good for my stomach.

cua

p.s. the project is using mostly c constructs, as you can see

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [June 23, 2022, 11:31pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/16 "2022-06-23T23:31:05Z")

</div>

This code gives 1 or more syntax errors in any C++98 compiler (perhaps not in the 80’s).  
There must be some more relevant code, if you really can compile this.  
I can think of:

A. Macro defined like  
`#define my_data(a1,a2,a3,a4) my_data(a1,a3,a4)`  
Invisible for the debugger. Please look at the preprocessor output.

B. An additional overloaded function like

```nohighlight
int my_data(char *comment, int IgnoredArg, const char *data, int length) {
  return my_data(comment, data, length);
}

```

exists.  
If you compile in Debug mode without optimization you should recognize this by single stepping.

For any problem the preprocess output will help. You can easily search for all `my_data` definitions inside and find out in which headers they were defined.

Against wrongly/accidentially overloaded function, only coding conventions like using namespaces and/or classes helps.

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [June 23, 2022, 11:40pm UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/17 "2022-06-23T23:40:36Z")

</div>

This code would give a warning (if not an error) in any of the compilers I have used.

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 24, 2022, 4:20am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/18 "2022-06-24T04:20:34Z")

</div>

In the 80s there were warning/error messages.

At present I am using VS2019 and there I see no messages.  
I think you are right, it is within the present context(prep directives etc.), because I cannot reproduce it within a clean project, just using the call and the function above. Here I get the messages I’d like to have.

I’ll try to find it out and let you know.

Thank you very much(to all of you)

cua  
michael

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [June 24, 2022, 6:13am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/19 "2022-06-24T06:13:10Z")

</div>

Function-like macros that use the same convention as normal functions are a recipe for disaster and sometimes in a way no compiler can warn about. The thing will get replaced in a weird way when you least expect it. From your example I guess this is where the problem originates from.

---

<div class="post-metadata">

### Author: ![michaelk1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@michaelk1](https://discourse.cmake.org/u/michaelk1)
#### Post date: [June 24, 2022, 6:39am UTC](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893/20 "2022-06-24T06:39:37Z")

</div>

I agree with that.

In that case, i am expanding code which i have not written, this is getting me in this problematic situation.

Well, i think i write my own parser, finding these kind of calls(where the amount of parameters differs).

thank you.

cua  
michael

[Next page](https://discourse.cmake.org/t/visual-studio-2019-c-is-it-possible-to-suppress-function-overloading/5893.md?page=2)
