Thread: Converting a code

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    Converting a code

    Hi guys, I want to ask about when I write a code, who's in charge of converting my code rows to the CBU for getting compiled and executed?!
    sorry about that confusing question !

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    This is rather mind boggling: what material are you using to learn C? Didn't it explain to you why you have to use a compiler to compile your C code before you could run your program?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Apr 2015
    Posts
    596
    for example according to what I'm asking, how compiler know that "casting" is allowed and not allowed on PC ?!

    Maybe I miss the understanding of program "COMPILER"

  4. #4
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by laserlight View Post
    This is rather mind boggling: what material are you using to learn C? Didn't it explain to you why you have to use a compiler to compile your C code before you could run your program?
    No, all what he said that compiler is a platform between "programmer" and PC , but didn't explain how it's going .. so that makes me everytime I code as a MIND BOGGLING what's going on !

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Because the C standard specifies what a cast looks like (syntax) and what it means (semantics), so when looking at your source code it is possible to determine if it is allowed. However, it is still possible that your cast conforms to C syntax and even semantics, but has a semantic error beyond what the compiler can determine, e.g., you cast an int to a pointer, which might be fine on some systems as long as it follows what is documented, but be nonsensical in others.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by laserlight View Post
    Because the C standard specifies what a cast looks like (syntax) and what it means (semantics), so when looking at your source code it is possible to determine if it is allowed. However, it is still possible that your cast conforms to C syntax and even semantics, but has a semantic error beyond what the compiler can determine, e.g., you cast an int to a pointer, which might be fine on some systems as long as it follows what is documented, but be nonsensical in others.
    You mean by semantics, it's just related to the language itself not related to the CBU operations? meaning the "CASTING" is an operational semantics related just and only to the language !

    Moreover, could you please explain what is "compiler" mean? illustrate that please in aspect of what a programmer must know about it because everytime I want to write a code that thing baffled me in aspect of how compiler works!


    thanks alot

  7. #7
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    CBU means crazy be user ?

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by RyanC
    You mean by semantics, it's just related to the language itself not related to the CBU operations? meaning the "CASTING" is an operational semantics related just and only to the language !
    You're programming in C, not in assembly language or directly in machine language, so of course the semantics of what you are programming are for C, not for assembly/machine language, and hence do not have any direct relationship with CPU operations.

    Quote Originally Posted by RyanC
    Moreover, could you please explain what is "compiler" mean? illustrate that please in aspect of what a programmer must know about it because everytime I want to write a code that thing baffled me in aspect of how compiler works!
    Back the bad old days, you would be told to STFW. This really isn't hard to find, e.g., whatis.com entry for "compiler". If you really want to know in detail, then go learn about compiler construction; it is often part of an undergraduate computer science/software engineering university course.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by laserlight View Post
    You're programming in C, not in assembly language or directly in machine language, so of course the semantics of what you are programming are for C, not for assembly/machine language, and hence do not have any direct relationship with CPU operations.


    Back the bad old days, you would be told to STFW. This really isn't hard to find, e.g., whatis.com entry for "compiler". If you really want to know in detail, then go learn about compiler construction; it is often part of an undergraduate computer science/software engineering university course.
    Alright, thank you !

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting code
    By bananen in forum C Programming
    Replies: 4
    Last Post: 04-19-2017, 08:25 AM
  2. Converting, pumping Raw C code, Source code
    By secretcode in forum C Programming
    Replies: 5
    Last Post: 06-03-2016, 09:01 AM
  3. Converting C code to DLX assembly code
    By xyz3 in forum C Programming
    Replies: 2
    Last Post: 05-17-2010, 02:01 PM
  4. C Code for converting generic to binary code
    By vanilla in forum C Programming
    Replies: 5
    Last Post: 11-05-2009, 03:34 AM
  5. Converting C++ code to C
    By alixi in forum C Programming
    Replies: 3
    Last Post: 09-21-2004, 02:23 PM

Tags for this Thread