Thread: Are C, and ANSI C the same?

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    65

    Are C, and ANSI C the same?

    Hey everyone,

    I haven't been on here in a while. I came here for help on C a very long time ago, and I tried writing a simple Hello World. I finally got it, but wasn't understanding. My thread went on forever that I didn't even bother trying anymore, so I gave up.

    I want to try it again.

    I am interesting in learning ANSI C, and once I learn that I want to learn ASM using the book called Write Great Code. I'll save that for the last. I have some questions.

    I have a thread over at VBforums. I wasn't understanding the answers that the person gave. I'll ask my questions slowly on this forum.

    1. Are pure C, and ANSI C the same, or different?

    2. I asked on VBforums about the MinGW compiler being good to compile ANSI code. The person said no, but with programming/high level term words that I have no clue what the user said. I'll ask here. Would MinGW be a good ANSI compiler for a Windows 7 desktop PC?

    3. Would C Primer Plus be a good book to learn ANSI from? I know that book is good for pure C, but I'm not sure about the ANSI part.

    If anyone could get back to me, I would appreciate it.

    Thank you,

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    C is a standard language. It has a standard, so all implementers of the compilers must comply with the standard. This standard was called in ages past ANSI C. Today, it is known as ISO C, because it is no longer an American standard, but an international standard.
    To be precise, the standard is called ISO C (was called ANSI C) and the language is called C. So in that sense, they are the same.
    Is MinGW a good compiler to compile C code? Yes! And don't think any less. It complies with the latest, ISO C99, standard.
    Last edited by Elysia; 08-29-2011 at 01:23 PM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by php111
    I have a thread over at VBforums. I wasn't understanding the answers that the person gave. I'll ask my questions slowly on this forum.
    You should have linked to the thread and/or stated what your previous questions were and what were the answers you received. A search brings up: Are C, and ANSI C the same? Frankly, if I had not done the search first, my answers would be similiar to those already given to you.

    Quote Originally Posted by php111
    1. Are pure C, and ANSI C the same, or different?
    That depends on what you mean by "pure C".

    Quote Originally Posted by php111
    2. I asked on VBforums about the MinGW compiler being good to compile ANSI code. The person said no, but with programming/high level term words that I have no clue what the user said. I'll ask here. Would MinGW be a good ANSI compiler for a Windows 7 desktop PC?
    The person did not say no. Take it as a yes.

    Quote Originally Posted by php111
    3. Would C Primer Plus be a good book to learn ANSI from? I know that book is good for pure C, but I'm not sure about the ANSI part.
    How do you know that the book is good for "pure C"? Generally, what I suggest is that if you do use the MinGW port of gcc, compile with the -ansi or -std=c99 options, and also with -Wall and -pedantic. These options will enable warnings that suggest to you when a non-standard construct might be in use.
    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

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 1. Are pure C, and ANSI C the same, or different?
    I don't know what you mean by "pure".
    So far, there have been the following versions.
    Archaic 'C' - as defined by the original K&R book.
    ANSI-C89 - was the first standard for the language.
    ISO-C90 - was the international version of the C89 ANSI standard. In technical detail, these are the same.
    ISO-C99 - is the second international standard.
    ISO-C11 - is the third standard. This has only just been ratified in the last few months. It will be a while before compilers emerge which fully support this.

    Now actual compilers will support one or more of these standards. Almost all of them will extend the language in some way, depending on the whims of the compiler writers. If you're looking for 'pure' C, then you typically have to use some command line flags.

    For example, gcc (and the MinGW port), you would do
    gcc -ansi -pedantic prog.c
    to ensure that all your code was strictly C89 code.

    > 2. I asked on VBforums about the MinGW compiler being good to compile ANSI code.
    When you start to use the API's of your OS, then strictly speaking, it is no longer 'pure' ANSI/ISO 'C'.
    But by careful wrapping of your interface code in separate source files, you can make it so that a lot of your code is ANSI/ISO C only.
    For example, gotoxy would be put into a separate (non-ISO) source file, and the rest of your (ISO) code would just call it. If you ported the code to say Linux, then you would only have to re-write one function - not your entire code base.
    So yes, MinGW is perfectly reasonable for writing code on windows. Get the version which comes with Code::Blocks for a very easy to install, and reasonably up to date.

    > 3. Would C Primer Plus be a good book to learn ANSI from?
    ACCU :: Book Reviews Search
    It seems as good a choice as any.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Apr 2006
    Posts
    65
    Thank you so much to both of you.

    Someone told me a long time by calling it pure C, because of building applications, or build an OS would be pure C because that's what I'm looking for. He told me that years ago on the Sky OS forum that I would need to learn ANSI C, and off of the forum he told me pure C. The reason why he said pure C, because what I'm looking for is based off of C, and ASM to build an OS that I'm asking for, and for me it doesn't use C++, or C#. Does he mean ANSI C would be pure C? I don't have the link of my thread over at SkyOS. I didn't say my MSN messages from him. I believe he blocked me years ago.

    Would the book I said be a good book?

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    In this case, I think he most likely is referring to the fact that "only" C is used. No mix-in of other languages, such as C++.
    That said, you don't need to make an OS entirely in C. And if I were you, I wouldn't limit myself to C and assembly.
    Use the right tool for the right job. Some things of the OS needs to be coded in assembly. Some parts might need C.
    But the UI, for example, does not need to be written in C. Use whatever language you find most suitable to the task at hand here.
    C++ is usually a very good choice because it interfaces with C and assembly easily. Other languages are possibly, but interoperability will be harder.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Purity here is apparently meaning that you would be only using C (specifically ANSI C) to write, as opposed to C plus another language. Of course, he can't mean it. He did say use C and ASM (assembly).

  8. #8
    Registered User
    Join Date
    Apr 2006
    Posts
    65
    Maybe the following thread will help? My posts, and his posts went off the hook with the quoting. It was nothing but quote after quote without the multi-quote. In fact, a moderator had to step in because we were quoting one thing after another. LOL. It was pretty cool. I forget what the moderator said.

    Just avoid the quoting part.

    SkyOS Forum • View topic - how to build an OS?

    As far as MinGW, I don't know how to use command line. All of my windows applications I use are GUI based. Will someone help me so I can, and know how to use the command line?

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by php111 View Post
    As far as MinGW, I don't know how to use command line. All of my windows applications I use are GUI based. Will someone help me so I can, and know how to use the command line?
    Use an IDE such as Code::Blocks.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    Apr 2006
    Posts
    65
    I'm not even going to quote, because it will never end. That's why I have been replying.

    Would IDE Code::Blocks be command line, or GUI?

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    @php111:

    From reading your other threads, you're trying to learn C and assembly to build an OS, but you can't even handle using the command line in Windows yet. I don't want to discourage you, but you are not ready for this, not even close. I've been programming C for around 15 years, and have done my fair share of assembly, and the thought of writing an OS, even a simple one, still intimidates me a bit. First, learn the appropriate vocabulary and terminology for what you're doing, and learn to use your OS. Then, take the time to master C, and after that assembly. Learn about computer architecture. Contribute to an open source OS like Linux. Move on to learning OS concepts. Then try writing an OS.

    Code::Blocks with MinGW is a great start, but you have to start at the beginning. We have tutorials here (Cprogramming.com - Programming Tutorials: C++ Made Easy and C Made Easy), and Google will give you hundreds more. Pick up a good book. You have one you mentioned here, your SkyOS thread mentioned another, and we have several more here: C Book Recommendations. Good luck!

  13. #13
    Registered User
    Join Date
    Apr 2006
    Posts
    65
    Quote Originally Posted by Elysia View Post
    I looked at that wikipedia site, and I read your reply, but I am really confused. I'm not understanding what Code::Blocks are? I don't know what you mean by it's an IDE. I always thought that IDE was part of the desktop?

  14. #14
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    What part of...
    Quote Originally Posted by Wikipedia
    An integrated development environment (IDE) (also known as integrated design environment, integrated debugging environment or interactive development environment) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of:

    a source code editor
    a compiler and/or an interpreter
    build automation tools
    a debugger

    Sometimes a version control system and various tools are integrated to simplify the construction of a GUI. Many modern IDEs also have a class browser, an object inspector, and a class hierarchy diagram, for use with object-oriented software development.[1]
    ...do you not understand?
    It described exactly what an IDE is, and it's not part of the desktop (it doesn't say that anywhere!).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    Registered User
    Join Date
    Apr 2006
    Posts
    65
    I believe that this is too confusing for me. I wanted to learn Code::Blocks, but still not understanding. I NEVER been a programmer before.

    What would be my first step to learn ISO/ANSI C? I have no clue where to start, because I am not a programmer.

    Even the easiest programming language would be difficult. How do I know? I tried things like Ruby, but too hard.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ansi C, C99
    By cookie in forum C Programming
    Replies: 6
    Last Post: 06-07-2007, 08:29 PM
  2. Ansi-c?
    By Encrypted in forum C Programming
    Replies: 3
    Last Post: 01-22-2003, 11:11 PM
  3. Ansi C
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 03-19-2002, 05:44 PM
  4. ADO And ANSI C
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 02-12-2002, 04:50 PM
  5. What is the Difference between ANSI C and non-ANSI C ?
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-24-2001, 06:55 AM