Page 1 of 10

Who here doesn't use C and why?

Posted: Sun Dec 23, 2007 1:12 am
by thegreatseph
I have never been a C programmer. I started with BASIC on a Commodore 64 and then dabbled in Pascal when I got a Machintosh, once I got an IBM PC I started to learn C, and asm and then learned that I couldn't read or maintain my programs very effectively. Then I decided that I'd fall back on Pascal as I used to use it a bit, and I have never looked back since then.

I have a few other reasons that I am not a fan of C, but it strikes me that it seems that I always score very high on verbal/linguistic tests sections of tests, and only average in math. Now everyone learns differently, but, it seems that I have trouble equating symbols to commands or instructions, and that is what makes C so completely unreadable to me. For example using { and } as Begin and End or v++ instead of Inc (v); which just doesn't really register with me very well.

Point is, while there is while Pascal involves typing everything out, That certainly seems to be an advantage to me, but I certainly understand a programmers desire to save time by not having to type as much, it just doesn't work for me.

Of course there are other reasons I use pascal, such it not letting me write dangerous code too easily (it can still be done though) and the general structure of the language... So my question is Who here doesn't use C (or it's derivatives like C++) and why did you make that choice?

Posted: Sun Dec 23, 2007 1:31 am
by inflater
Me! :D

I prefer too, begin,end,procedure,function,... in pascal. Its just better for your eyes to see words instead of bloated symbols like {,},();,void _main(*char @args);...
So i'm a pascalist too,plus some assembly doesn't hurt :)

Regards
inflater

Posted: Sun Dec 23, 2007 5:14 am
by AndrewAPrice
inflater wrote:Me! :D

I prefer too, begin,end,procedure,function,... in pascal. Its just better for your eyes to see words instead of bloated symbols like {,},();,void _main(*char @args);...
So i'm a pascalist too,plus some assembly doesn't hurt :)

Regards
inflater
You could always typedef BEGIN to {, END to }, and . to ;.

Anyway, I find it easier to read curly bracket programming languages because it is much easier for me to destinguish between a block of code grouped with {} and instructions. Being use to this sort of language style makes it easier to scan through C, D, Java, etc, code since my eyes instantly distinguish between what defines a block of instructions and what they actual instructions are. Other people would be use to other coding styles. And after saying that, neatly written Pascal code would be more understandable than messy C code to most C-biased programmers.

Once you know a language well enough the writing/reading code in that language becomes second nature, then how well you understand a program/algorithm/etc will be based more on how well you understand the algorithm being used rather than the language itself (assuming you're comparing languages with the same level of features, i.e. not brainf*ck vs VB).

The other reason why I prefer C (and C++) is due to its user-base. When you're searching for support, example code, or trying to get into the industry, being able to read/write C/C++ code is beneficial. And also, most libraries are written in C.

Posted: Sun Dec 23, 2007 11:47 am
by SpooK
I tend to use Assembly Language (NASM) more than C. The reason being is that most of my hobby development involves an OS kernel and ASM offers me the kind of control that C never could... not to mention avoiding real (inefficient instruction/memory usage) bloat.

I use C for bigger and more generic projects where control is not an issue, full portability is a concern and the bloat is an acceptable trade-off for the decrease in development time.

Bottom line: Use the right tool for the right job.

P:S The right tool is whichever one you are comfortable and happy with in your development process ;)

Posted: Sun Dec 23, 2007 12:14 pm
by Craze Frog
I don't use C.

- C is unreadable
Compare { vs. begin

- C is untypable
{ requires AltGr+7, which means stretching or moving the hands a lot

- C is illogical
An empty parameter list does not mean no parameters, but any number of parameters.
In "int unsigned* ptr, notptr;" notptr does not become a pointer, but it becomes unsigned.

- The de facto free C compiler, gcc, is very slow (I'm talking about the compilation time)

- C is inconsistent
* in declarations means you want a pointer.
* in normal lvalues means you don't want the pointer, but the value it points to.

- C is too low-level for serious application programming
It doesn't even have a string datatype. Writing even simple programs takes a lot of time if you want them reasonably bullet-proof.

- C is too high-level for system programming
How do you reliably write code that interfaces with the hardware when the bit sizes of types aren't defined?

- C's preprocessor features are very basic and too error-prone compared to the things you can do with it

- C requires makefiles or similar
Lots of typing and thinking for what can easily be done automatically by the compiler

- C requires header files
Lots of typing for what can easily be done automatically by the compiler.

- C uses escape characters in character strings, thus molesting path names in some operating systems
You can say it's no big deal as C is for UNIX, but on the other hand, they made the type system unusable under the cover of cross platform-ness, so why did they suddenly stop caring?

- C doesn't know basic math
If a has the value 6385921 and you do "a += 1;" then a may well have the value 6385925 if a was declared as int *.

- C doesn't know basic logic
There is no non-bitwise XOR operator in C.

- The last good thing written in C was Händel's recorder sonata

Posted: Sun Dec 23, 2007 1:11 pm
by packet50071
c is illogical :shock:
For me C is very logical than other language

but c offers flexibility - and speed if u think correctly
ex
a replace function that i made finishes its replacing before 10 sec than
the default replace function in VB and basic

but some times C is frustrating for me due to its lack of memory management -- so i use other language for that time

:D

Posted: Sun Dec 23, 2007 1:18 pm
by Dex
I have learnt a lot of programming languages, but try as i may i can not get my head around C. I found pascal very readable and ASM easy to learn.

Its may have something to do with me being dyslexia, but why then do i fine pascal easy to read and understand.

Anyway, if you tell people that ASM is easier to learn than C, they thing your having a joke.

Posted: Sun Dec 23, 2007 1:34 pm
by Combuster
I mainly grew up with quickbasic, and later, VB5 (and still use it). It means that if I want something done quickly that I write everything in Basic.

I can read and write C pretty well, as well as many derivated curly bracket languages, like C++ and Java. The main drive not to write in VB is that MS dropped support for it (and vb.net is a rip-off), and it doesn't work outside windows. (i.e. linux, os development, console homebrew)

I do use FreeBasic as part of OS development, because it allows me to write programs in my native tongue, but I regularly miss the things VB had to offer.

If I had to choose a programming job now, it'd be one that requires java or PHP. They don't offer VB anymore.
{ requires AltGr+7, which means stretching or moving the hands a lot
I use a non-US keyboard as well ( {} = AltGr+8/9 ), but what you lose at typing curly braces you get back when you don't need to think twice after each quote to avoid getting compile errors on symbols like äéò and everything when you do use the US-international layout. (which is completely flawed if I believe what they say at human-computer interaction colleges :evil:)
- The last good thing written in C was Händel's recorder sonata
ROFL :lol:
Anyway, if you tell people that ASM is easier to learn than C, they thing your having a joke.
I understood assembly long before I understood C, even though I had a head start with C. In fact I think that I was able to understand C because I understood assembler. It probably has to do with the fact that pointer math is _very_ confusing for beginning programmers, and C provides few cues on how to do it correctly. Once you understand memory addressing in assembly, you can figure out somewhat how C does it.

I in fact know someone who kept messing with C++ (adding and removing *s until it compiled) and never knew what he was doing. He did get along pretty well with Python though.

Good to know though that C-slexia isn't too uncommon really. (oops, coined a term :wink:)

Posted: Sun Dec 23, 2007 3:48 pm
by Craze Frog
I in fact know someone who kept messing with C++ (adding and removing *s until it compiled) and never knew what he was doing. He did get along pretty well with Python though.
Exactly. One of the thing that annoys me most about C is the pointer system is the dereference operator. It's neither particularly powerful, particularly safe, nor particularly flexible, but it IS particularly hard to get right every time.
Did you know it's possible to create a pointer system that you can do everything you can with C's pointer system without the dereference operator? (Of course it's done in a different way, since there is no dereference operator...)
Anyway, if you tell people that ASM is easier to learn than C, they thing your having a joke.
I actually think ASM is easier to learn that C if you know another procedural language already. The operations are simple and uniform, two words I wouldn't use in the same sentence as C (oups).
packet50071 wrote:but c offers flexibility
C has all the expressive power of two dixie cups and a string.
-- Jamie Zawinski

Posted: Sun Dec 23, 2007 5:06 pm
by AndrewAPrice
Craze Frog wrote:I don't use C.

- C is unreadable
Compare { vs. begin

- C is untypable
{ requires AltGr+7, which means stretching or moving the hands a lot
You can use $( and $) instead of { and }.
Craze Frog wrote:- C is illogical
An empty parameter list does not mean no parameters, but any number of parameters.
In "int unsigned* ptr, notptr;" notptr does not become a pointer, but it becomes unsigned.
I usually put the * next to the variable name, e.g.:
int unsigned *ptr, noptr;
If you wanted them to both be pointers use:
int unsigned *ptr, *noptr;
But people have their own coding styles.
Craze Frog wrote:- The de facto free C compiler, gcc, is very slow (I'm talking about the compilation time)
GCC isn't the only C compiler. Have you heard about TCC and TCCBOOT (a bootloader that compiles and runs Linux in 10 seconds).
Craze Frog wrote: - C is inconsistent
* in declarations means you want a pointer.
* in normal lvalues means you don't want the pointer, but the value it points to.
I know. I guess it's because:
int *ptr = 5;
wouldn't make much sense if ptr wasn't pointing to anything.
Craze Frog wrote:- C is too low-level for serious application programming
It doesn't even have a string datatype. Writing even simple programs takes a lot of time if you want them reasonably bullet-proof.
C is designed to be low-level. It's suppose to be "minimal" whereby things such as strings, which aren't a feature of the CPU aren't included in the language definition, but rather the implementation - this way a string could be variable length based around chars, wchar_ts, ints, etc. C++ solved a lot of this difficulty by having a STL string class.
Craze Frog wrote:- C is too high-level for system programming
How do you reliably write code that interfaces with the hardware when the bit sizes of types aren't defined?
I don't know where you're getting this from but the only bit of non C/C++ code in my kernel (other than the odd inline assembly) is the code that sets me up to call my C++ main() function, and my interrupt stubblets (which then calls C++ code). All my device drivers are done using C++, passing C-style structs when I need be (which can have individual bits aligned).
Craze Frog wrote:- C's preprocessor features are very basic and too error-prone compared to the things you can do with it
How so? I don't think it's perfect, but adding any more features would make the preprocessor more of a compiler-scripting language that preprocessing.
Craze Frog wrote:- C requires makefiles or similar
Lots of typing and thinking for what can easily be done automatically by the compiler
No it doesn't. I use a bash shell script that loops through *.c and *.cpp. If you used Visual C++ you don't have to do anything but click "Add To Project" ;)
Craze Frog wrote:- C requires header files
Lots of typing for what can easily be done automatically by the compiler.
Craze Frog wrote:- C uses escape characters in character strings, thus molesting path names in some operating systems
You can say it's no big deal as C is for UNIX, but on the other hand, they made the type system unusable under the cover of cross platform-ness, so why did they suddenly stop caring?
What? When you input a string from the keyboard that has a \ in it, it gets recognised as the character \. Also, you can use \\ or @"[string here]".
Craze Frog wrote:- C doesn't know basic math
If a has the value 6385921 and you do "a += 1;" then a may well have the value 6385925 if a was declared as int *.
That's because you're increasing the pointer. You're pointing to the next int in memory after a. You should use *a += 1;. *a means "the value being pointed to by a", a means "the value of a".
Craze Frog wrote:- C doesn't know basic logic
There is no non-bitwise XOR operator in C.
Erm.. what do you think ^ is?

You shouldn't judge a language before you know it. Sure it's not perfect, but you're making a lot of incorrect assumptions here that just make you look foolish (especially your second to last question).

I could say the same about Pascal or BASIC if I never used them before and assumed the same. Besides, if C was really that unreadable and illogical, why is most of the industry/open source software/etc focused on C and C++?

Posted: Sun Dec 23, 2007 5:09 pm
by AndrewAPrice
Dex wrote:I have learnt a lot of programming languages, but try as i may i can not get my head around C. I found pascal very readable and ASM easy to learn.
Sorry if my last post was a little harse. I know how you feel. I had a hard time moving from BASIC to C++. I think it was because I had to rethink my entire view on programming (getting use to objects, classes, etc). Different programming styles suit different people. :)

Posted: Sun Dec 23, 2007 8:03 pm
by GuiltySpark
Craze Frog wrote:I don't use C.

- C is unreadable
Compare { vs. begin
Personally, I think Python's use of indentation makes things much more readable than either solution.
- C is untypable
{ requires AltGr+7, which means stretching or moving the hands a lot
Yeah, braces suck, whether they be the keyboard or your teeth.
- C is inconsistent
* in declarations means you want a pointer.
* in normal lvalues means you don't want the pointer, but the value it points to.
It's the implicit contexts.

I used to have a lot of trouble with C++ references.

"Wait, I thought the & was supposed to get the address of something. Why doesn't int& give me the address..."

It has been said modal interfaces are confusing. I guess that goes with modal languages.
- C is too low-level for serious application programming
It doesn't even have a string datatype. Writing even simple programs takes a lot of time if you want them reasonably bullet-proof.
According to some, the first step should be writing (or acquiring) some libraries. Then write the application. My ability to find the perfect libraries for the job helped me more in the past than having all the tricks of C/++.

Of course now I'm doing osdev to get better of course.
- C is too high-level for system programming
How do you reliably write code that interfaces with the hardware when the bit sizes of types aren't defined?
Actually the limits.h file defines the size of types although not using bitsizes. I think C99 introduces u_int32_t and other similar types which have explicit bitsizes.

Posted: Mon Dec 24, 2007 12:14 am
by Alboin
MessiahAndrw wrote:Besides, if C was really that unreadable and illogical, why is most of the industry/open source software/etc focused on C and C++?
If the industry\FOSS world used the best and most logical tools (eg. programming languages), then it would by no means use C\C++. ;)

Posted: Mon Dec 24, 2007 1:53 am
by SpooK
Alboin wrote:
MessiahAndrw wrote:Besides, if C was really that unreadable and illogical, why is most of the industry/open source software/etc focused on C and C++?
If the industry\FOSS world used the best and most logical tools (eg. programming languages), then it would by no means use C\C++. ;)
OK, I see this thread has gained momentum in the bashing of languages instead of the promotion of alternatives.

So, to help redirect this thread away from yet another flame war, Alboin, what would you propose as an alternative to C/C++... and why???

As an aside, I have not seen a language that offers that fine mix of portability, flexibility, readability and power as well as C does. I'm not saying C is particularly great at any one thing, but it is pretty good at balancing multiple qualities that you'd want in a programming language.

Feel free to "educate" me on this matter... but go ahead and cross your t's and dot your i's before you start feeling too informative ;)

Posted: Mon Dec 24, 2007 8:55 am
by Masterkiller
I don't know and don't use C. I know C++, but it is language designed for 3rd level application, so it is easier to create an .exe than to create .bin.
I prefer ASM.
+ ASM is the easiest programming language that you can learn. All theory is to learn instructions and how memory is addressed.
+ ASM are smaller and rare. For example xmms instruction set contains about 50 instruction.
+ ASM is compatible with old programs. So your program will not expire.
+ ASM is portable. Yup, every program portable or not is compiled to ASM.
+ In asm there isn't such thing that "it can't" or "it won't", all that you can do in high-level language, you can do it in ASM.
+ ASM can make your program smaller and faster.
+ You know exactly how long are types: byte(1), word(2), dword(4), fword(6), qword(8), tbyte(10) - lol yes, there is only 6 types
+ A symbol represent address that can point to any type of memory, string, procedure, descriptor, pointer... Anything. You can name every line of code, so you don't need to work with addresses, compiler will do that for you.
+ You can easily compile you code without compiler due to simple way of converting.
+ You can get 99% of you compiled code back, so if you lost your code, but have the program, you can easily restore the code (only thing that is not restored is the names of the symbols).
- ASM code is longer
- ASM requires more time of programming since you start from nothing.