Overview
| Artifact ID: | 80a550a21f4778d971dfe3fdf0f0ffbbb12a0987 |
|---|---|
| Ticket: | 945570ffffffffffffffffffffffffffffffffff
public routines need private #define's |
| User & Date: | lobotomy642 on 2012-04-20 03:56:31 |
Changes
- icomment:
Hello, I would like to propose as the safest solution IMHO for TCL to have its own defines. In the example of Tcl_FSAccess this could be: #define TCL_FEXISTS 0 #define TCL_FEXECUTABLE 1 #define TCL_FWRITEABLE 2 #define TCL_FREADABLE 4 This would have the advantage: - to be system-independant, for compatibility - to provide a clearer name... - ...and less prone to clash On the TCL's internal implementation, I would suggest something like: if ((TCL_FEXISTS == F_OK) && (TCL_FREADABLE == R_OK) && (...)) { type_for_syscall = type_arg & (TCL_FREADABLE | TCL_FWRITEABLE | ...); // to avoid potential misused bits } else { type_for_syscall = 0; if (type_arg & TCL_FREADABLE) type_for_syscal |= R_OK; ... } Leting, of course, the compiler optimise the first if, so we'd have: - a code that is portable - a code potentially optimised if the defines matches the sys defs On a side note, I'd like to remind the note I raised in #3517838 about describing F_OK/TCL_FEXISTS as being actually 0, to prevent potential developper's headache with tests like "if (type & TCL_FEXISTS)". Talking about this bug, I also take the opportunity to thank you for the help. Regards, Christophe. - login: "lobotomy642"
- mimetype: "text/plain"
- username: "lobotomy642"