New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix _tkinter compiler warnings on MSVC #66334
Comments
Dropping support of Tk 8.3 caused a few compiler warnings on Windows: ..\Modules\_tkinter.c(587): warning C4090: '=' : different 'const' qualifiers Does this patch look like the correct fix? |
I'm surprised that this caused a warning. In man page Tcl_GetObjType() is described as
and in header file it is declared as EXTERN Tcl_ObjType * Tcl_GetObjType _ANSI_ARGS_((char * typeName)); But this change shouldn't add any ill effect. The patch LGTM. |
Serhiy: See http://svn.python.org/projects/external/tcl-8.6.1.0/generic/tclDecls.h where it now is EXTERN CONST86 Tcl_ObjType * Tcl_GetObjType(const char *typeName); I think the patch is wrong as it stands, as "const" is not a reserved word in C89. Instead, you should be using something like #ifndef CONST86
#define CONST86
#endif Tcl_ObjType CONST86 *BooleanType; |
Oh, my fault. I did not notice that my tcl workspace was switched to 8.3
"const" was introduced in ANSI C (aka C89) and it is reserved word. The patch |
I see. So the patch is fine indeed. |
Thank you both for the reviews! Embarrassingly, I just realized that I didn't post the patch I meant to; in quickly reconstructing the patch after accidentally destroying a previous version, I made it "Tcl_ObjType const *SomeType;" instead of "const Tcl_ObjType *SomeType;". It seems to me that "const <type>" is much more common than "<type> const"; does it actually matter which way it goes? Either way fixes the warnings. |
"const T" and "T const" are the same type. This compiles, and all variables have the same type: int main()
{
const volatile int a;
const int volatile b;
int const volatile c;
volatile int const d;
volatile int const etc;
} Even "volatile short const int" and "long volatile long const int" work. |
I see. There doesn't appear to be anything in PEP-7 about this; do we have a style preference for this that applies here? Or should I just shut up and commit it? :) |
Grepping through the source shows that currently, the const always goes before the type (for char, wchar_t, Py_UCS2, and int). So please do this style adjustment and commit. |
New changeset 7ed237478fcc by Zachary Ware in branch 'default': |
Done and done. Thank you very much, Martin. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: