Deprecated functions not spotted if using "System::Threading::ThreadState" (and others!) C++ VS2005/
- by Fishboy
Hi, I'm facing an issue with c++ on vs2005 and also vs2008...
here's how you can reproduce the issue....
create a new (c++) project called 'test' (file|new|project)
select "Windows Forms Application"
and add the 'stdio.h' include and the code fragment below into the test.cpp source file.....
-------------------start of snippet--------------------
#include <stdio.h>
...
int main(array<System::String ^> ^args)
{
int i;
System::Threading::ThreadState state;
char str[20];
sprintf (str, "%s", "test string");
...
-------------------end of snippet--------------------
If you compile the code as above (you'll have to 'buildall' first), you'll get two warnings about 'i' and 'state' being unreferenced (nothing about sprintf being deprecated).
If you comment out "System::Threading :Thread state;", you'll get one warning about 'i' being unreferenced and another warning (C4996) for the 'deprecated' sprintf statement....
This issue also occurs for "System::Windows::Forms::MessageBoxIcon", "System::Base64FormattingOptions" (and perhap all 'enum class' types!)
Anyone know of the cause and workaround to the issue demonstrated here ( i have other files that demonstate this issue..). (I had started a thread on msdn, but then found this site! see link below)
Visual Studio 2005 has stopped warning about deprecated functions