Re: C++ Compiling Problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



linux user wrote:
Matthew Miller wrote:


PS: if you want a book on C instead of C++, don't bother with

anything but

the original book by the language's creators: C Programming Language by
Brian Kernighan and Dennis Ritchie. As I said before, C is an

elegant and

small language, and this book is all you need. (Although you

may also want

to pick up The UNIX Programming Environment by Kernighan and Rob Pike.)


K&R C is no longer current, and I think it will give gcc severe heartburn.


This statement is false.  As a matter of fact if you use the programming
methodology in this book, you're good to go on any true ANSI C compiler,
which includes gcc...
The C programming language was devised in the early 1970s as a system implementation language for the nascent Unix operating system.

This is what I understand is meant by "K & R C."


Directly from http://www.gnu.org about gcc: "The GNU Compiler Collection is a full-featured ANSI C compiler with support for K&R C"

I understood the original semantics had been done away with some time ago.


There are altogether too many mistakes a C programmer can make that will
give rise to all sorts of program bugs including buffer overruns,
pointer overruns and underruns and many more.


Learn how to use the appropriate libraries/functions that limit the number
of input characters and buffer overruns are no issue.


There are uses for C; it was originally designed for programming
operating systems and such, and really is not well-suited at a
general-purpose programming language.


This is false.  Read more about it here:
http://cm.bell-labs.com/cm/cs/who/dmr/chist.html.
I quote:
The C programming language was devised in the early 1970s as a system implementation language for the nascent Unix operating system.


That seems to support my view of what it was designed for.

My opinion regarding its suitability as a general-purpose programming language is supported by its lack of features to help programmers to write correct programs as evidenced by the number of security updates for all distributions of Linux, for OS X, for Windows and so on, where so many of the problems are attributed to buffer overruns, to format-string problems and to other C features.




The act you _can_ write almost any program you can conceive in C doesn't
mean you should do so.


This is true, but it depends on what you intend to do with the language.  I
don't know of any C based languages that can outperform C for computational
based  programming.

I thought Fortran was most-often used for computation.

_My_ preference would be to not use C for anything where there is a viable alternative.



C doesn't do strings.


This is false.  Read the "string.h" library.  It's specifically written to
handle strings.

I've already refuted this. Those are arrays of characters, not the same thing at all.


C doesn't do fixed-point.


I don't know what is meant by this.  If it means floating point, again this
is incorrect.  C is capable of performing computations with integers,
floats, and doubles.  What else is there?

fixed-point. It's the representation you need in finance. It can handle non-integer numbers with a decimal point, it handles scaling, and truncation with well-defined precision. PL/1 does it thus:
dcl balance fixed decimal (11,4); /* and the usual numeric operations can be done */
and COBOL
77 balance picture is '9(11).9(4)' usage is computational-3.
Again, it's a number like any other.


Don't use floating-point where you need fixed-point. They are not the same.







Both are needed in business applications.

C++ is another matter altogether, and provided programmers use the C++
features, code written in C++ is likely to be more reliable than
equivalent code written by equivalently-capable C programmers.


If you want to learn an easy OOP then Java or C# are the best place to
start.  The foundations of all of the languages C++, Java, and C# are based
on C.

I favour Java. Or Borland's implementation of Pascal (but watch your money).

Note that Java does do fixed-point arithmetic.


--

Cheers
John

-- spambait
1aaaaaaa@xxxxxxxxxxxxxxxxxxxxxxx  Z1aaaaaaa@xxxxxxxxxxxxxxxxxxxxxxx
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux