Pelles C forum
Pelles C => General discussions => Topic started by: dezmand07 on February 17, 2023, 08:08:40 AM
-
Hello.
I switched from Visual Studio to Pelles C.
Why is the auto keyword implemented in Pelles C if it doesn't work?
auto hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
warning #2099: Missing type specifier; assuming 'int'.
error #2082: Invalid initialization type; expected 'int' but found 'void *'.
error #2168: Operands of '=' have incompatible types 'int' and 'void *'.
-
HANDLE CreateToolhelp32Snapshot( [in] DWORD dwFlags, [in] DWORD th32ProcessID);
CreateToolhelp32Snapshot returns a HANDLE, not int.
-
Hi dezmand07,
I think perhaps a misunderstanding of the use.
The 'auto' keyword does not determine the type it determines the scope, location, initial value and where stored.
So the use of auto in the case below is missing the return value type HANDLE.
Attached is a helpful table on storage classes sourced from from https://www.geeksforgeeks.org/storage-classes-in-c/
John Z
-
HANDLE CreateToolhelp32Snapshot( [in] DWORD dwFlags, [in] DWORD th32ProcessID);
CreateToolhelp32Snapshot returns a HANDLE, not int.
Yes I know that. That is why I did not in vain mention about Visual Studio.
I thought that in Pelles C it's implemented.
-
Attached is a helpful table on storage classes sourced from from https://www.geeksforgeeks.org/storage-classes-in-c/
Thank you. This clears things up a bit.
-
MS C is MS C, not a C standard compliant at all.