Title | mps.h defines the macro MPS_T_WORD |
Status | closed |
Priority | nice |
Assigned user | Gareth Rees |
Organization | Ravenbrook |
Description | The MPS external interface in mps.h [1] defines the macro MPS_T_WORD: #ifndef MPS_T_WORD #if defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64) #define MPS_T_WORD unsigned __int64 #else #define MPS_T_WORD unsigned long /* won't be true on W3I6MV */ #endif #endif /* MPS_T_WORD */ and then uses it to define the type mps_word_t: typedef MPS_T_WORD mps_word_t; /* pointer-sized word */ This is against the policy of not defining symbols from mpstd.h in the external interface. |
Analysis | The external interface is careful not to include mpstd.h, because the latter is "picky" about details of compilers, operating system versions and so on, and we don't want peoples' MPS programs to stop working just because an compiler upgrade causes a preprocessor constant to change. (If they are building MPS from source then they will be hosed, but if they are linking against a pre-built library, as they will be if they installed the MPS via a ports collection, the new platform will almost certainly continue to work.) So perhaps the above code could be changed to: #if defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64) typedef unsigned __int64 mps_word_t; #else typedef unsigned long mps_word_t; #endif |
How found | inspection |
Evidence | [1] <http://info.ravenbrook.com/project/mps/master/code/mps.h > |
Observed in | 1.110.0 |
Created by | Gareth Rees |
Created on | 2012-10-17 17:00:04 |
Last modified by | Gareth Rees |
Last modified on | 2013-03-08 15:25:14 |
History | 2012-10-17 GDR Created. |
Change | Effect | Date | User | Description |
---|---|---|---|---|
181096 | closed | 2013-03-08 14:03:10 | Gareth Rees | Follow policy of not defining symbols from mpstd.h in the external interface, by removing the definition of MPS_T_WORD from mps.h. |