Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/30/08 07:18
Read: times


 
#154194 - I think you missed the point
Responding to: ???'s previous message
Shivaram Kumara Cunchala said:
I want a program which tells me the size of the processor on which i am running the program.

I think you missed the point:

You cannot have a program that will just run on any arbitrary processor - it has to be compiled for the specific target processor.

In other words:

  • Before you can run the program, you need to build it;

  • In order to build it, you need to choose an appropriate compiler for the specific processor;

    Because the Compiler has to generate code for the specific processor it must know, at compile time, what the processor is - including whether it is 8-bit, 16-bit, or whatever.


    i want to print size of the processor

    How about:
    #if defined _MSC_VER
    printf( " This is Microsoft 'C'" );
    
    #elif defined __GNUC__
    printf( " This is GCC" );
    
    #elif defined __BORLANDC__
    printf( " This is Borland C" );
    
    #elif defined _CC51 
    printf( " This is the Tasking 8051 Compiler" );
    
    #elif defined __C51__ 
    printf( " This is the Keil C51 Compiler " );
    
    #else
    #error Unsupported Compiler!
    #endif
    



  • List of 22 messages in thread
    TopicAuthorDate
    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      

    Back to Subject List