| ??? 04/30/08 05:44 Read: times |
#154187 - C is not that portable! Responding to: ???'s previous message |
Before a 'C' program can run on any processor, it has to be compiled using a compiler for that specific precessor, Therefore you have to know the processor - and, therefore, its size - before you can even compile the program.
Compilers usually provide some predefined macros that can be used to identify the particular compiler; eg, #if defined _MSC_VER // This is Microsoft 'C' #elif defined __GNUC__ // This is GCC #elif defined __BORLANDC__ // This is Borland C #elif defined _CC51 // This is the Tasking 8051 Compiler #elif defined __C51__ // This is the Keil C51 Compiler #else #error Unsupported Compiler! #endif See: http://www.8052.com/forum/read.phtml?id=136086 |
| Topic | Author | Date |
| find the size of processor | 01/01/70 00:00 | |
| C is not that portable! | 01/01/70 00:00 | |
| thanks but could u clarify | 01/01/70 00:00 | |
| I think you missed the point | 01/01/70 00:00 | |
| Various compilers different results | 01/01/70 00:00 | |
| Word size - not code size? | 01/01/70 00:00 | |
| u r correct | 01/01/70 00:00 | |
| Determining object sizes - at run time | 01/01/70 00:00 | |
| Not quite | 01/01/70 00:00 | |
| Correct ! | 01/01/70 00:00 | |
| not sure what you would do with the information | 01/01/70 00:00 | |
| This was an interview question | 01/01/70 00:00 | |
| More trick interview questions | 01/01/70 00:00 | |
| I found the solution, Andy , Neil please comment | 01/01/70 00:00 | |
| Great! Now do it in C | 01/01/70 00:00 | |
| Same logic for C and asm | 01/01/70 00:00 | |
| No, it isn't. | 01/01/70 00:00 | |
| What would be the point? | 01/01/70 00:00 | |
| It is worse than that | 01/01/70 00:00 | |
| the whole question is silly | 01/01/70 00:00 | |
| It can even get this silly... | 01/01/70 00:00 | |
It is an interview question | 01/01/70 00:00 |



