Who here doesn't use C and why?

Programming, for all ages and all languages.
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post by Craze Frog »

MessiahAndrw wrote:
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 }.
$ also requires AltGr, +4 this time.
If you wanted them to both be pointers use:
int unsigned *ptr, *noptr;
I know, I just said it was illogical.
GCC isn't the only C compiler. Have you heard about TCC and TCCBOOT (a bootloader that compiles and runs Linux in 10 seconds).
Yes, and I've heard of about 8 other C compilers as well. Unfortunately I wasn't able to compile pcc for linux. But most C projects use GCC because it generates the fastest code of the free C compilers.
I know. I guess it's because:
int *ptr = 5;
wouldn't make much sense if ptr wasn't pointing to anything.
I know why, it's still inconsistent.
MessiahAndrw wrote:
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.
It is my personal opinion that if C was designed to be low-level they failed. It's too high-level.
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).
And what if it's suddenly compiled by a 32-bit compiler that uses 8-bit ints. Oups there your page tables are all messed up. Of course, there are solutions to this mess, but introducing the problem in the first place was a bad idea.
MessiahAndrw wrote:
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.
I'm not listing reasons why C is bad, but why I'm not using it. By using fasm macros my asm code is much shorter than the similar C code. I simply don't like typing the same thing over and over. If you like it, fine, but if I have to do that when using C, then I won't use C.
MessiahAndrw wrote:
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.
That's what I called "similar". If you use Visual Studio it's a makefile-like thing going on under the hood as well.
MessiahAndrw wrote:
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]".
No. When I type "C:\hello\world\returns" it's interpreted as "C:\hello\world" then a carriage return and then "eturns" concatenated.
I know I can use \\, but introduce this problem in the first place?
MessiahAndrw wrote:
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".
Again, I know why, but I still don't like it. 1+1 should never be 5.
MessiahAndrw wrote:
Craze Frog wrote:- C doesn't know basic logic
There is no non-bitwise XOR operator in C.
Erm.. what do you think ^ is?
^ is the bitwise XOR operator, something completely different.
MessiahAndrw wrote:You shouldn't judge a language before you know it.
I'd say one of the first things you should learn about a language is its operators. :roll:
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).
If by "my second to last question" the you mean the pointer calculations, then that wasn't a question and it wasn't incorrect either. The same applies to the last statement.
MessiahAndrw wrote: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++?
Why is most of the industry/open source software/etc so prone to crashing?
It's the implicit contexts.
I know what it is, and I'm saying I don't like it!
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.
Not really. C is pretty good at balancing multiple qualities that you'd want in a programming language. Not I.

I think some people thought I pointed out bad things about C. I wasn't this time. I was pointing out things that I don't like about C, which is "why I don't use C" (the original question). I can perfectly understand why some people want 1+1 to be 9 (not 5 this time!), but personally I prefer it to be 2.

Also, I'm not saying that a perfect replacement for C exists. In fact, I'd say about the only reason it's used so much.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

Masterkiller wrote:+ ASM is the easiest programming language that you can learn. All theory is to learn instructions and how memory is addressed.
While assembly is minimal, getting used to it can be very difficult.
+ ASM are smaller and rare. For example xmms instruction set contains about 50 instruction.
Intels instruction set reference is by far larger than the C99 spec
+ 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.
Seriously, any decent assembly programmer knows that any code is limited to a range of processors that share the instruction set. Anything that deals with operating-system specifics is not portable at all. You can't assemble DOS programs under windows and expect it to run properly (even though the assembler might very well accept it, the output is not meant for non-DOS systems).
+ 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
check again: the processor has far more types than the assembler provides for you.

Also, a word is 32 bits if you ask the right person.
+ 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.
At the cost of having to figure out for yourself wether some constant represents an address, an immediate or whatever
+ You can easily compile you code without compiler due to simple way of converting.
I don't think anybody even *thinks* of doing it that way forever.
+ 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).
I'd estimate that my assembly code shrinks to 5% when you assemble it. The vast majority you lose are constants, labels, macro's, and most importantly, comments.
MessiahAndrw wrote:You shouldn't judge a language before you know it.
I think this applies here: while assembly does have its merits, I do think you've a lot to learn on the matter.

_________________
MessiahAndrw wrote:You shouldn't judge a language before you know it.
I'd say one of the first things you should learn about a language is its operators. :roll:
I agree with Craze Frog on many points: C is _very_ tricky for newcomers to understand. He is right to post his opinions. While I do not agree with all of them, he has a point and I would most certainly not claim that he is uneducated on the matter.

Both of you may want to consider taking on a more friendly tone though.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

SpooK wrote: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???
I would propose it, but I'm afraid signs of it happening are already appearing.

This is going to sound repetitive, but I'm feeling that functional languages will eventually dominate the general software development field. (ie. Systems having some power, not RAM lacking ARM systems. ;) ) C\C++ will still be there, but used less in application development.

C\C++ have no chance against something like Erlang when it comes to concurrency and hot swapping code. Moreover, with F# well on its way, I see no reason why the industry would stand still. The lack of people knowing functional programming is the only drawback, but with backing from Microsoft, I'm feeling that people will be able to pick it up quickly.

C\C++ just seems to outdated when you're using Haskell, Erlang, O'Caml, etc. (I'm not one to really talk.) For example, let us compare C's assignment operator to Erlang's pattern matching operator. Yeah, that's it.
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
binutils
Member
Member
Posts: 214
Joined: Thu Apr 05, 2007 6:07 am

Post by binutils »

IMHO, c is vital language, it will not go away next 10 years.

--
PS: 10 years, because i can't foresee the future of programming language, without the fact, i would say 100 years.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

binutils wrote:IMHO, c is vital language, it will not go away next 10 years.

--
PS: 10 years, because i can't foresee the future of programming language, without the fact, i would say 100 years.
It will never go away. Its user base will just shrink, and then, it will halt at a certain point.
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Alboin wrote:It will never go away. Its user base will just shrink, and then, it will halt at a certain point.
Here are some facts...

1) 99% of all Unix-like operating systems are written in C or C++.
2) Microsoft Windows, The unfortunate leader in the OS market, was also written in C/C++.
3) The mars rovers Spirit and Opportunity, use the real-time Unix-like operating system VxWorks.. Which was written in C/C++. ;)
4) Games, It seems logical to assume video games are written in C or C++ these days, or at least on systems where interpreted languages like Java wouldn't preform well.
5) Craze Frog likes confrontations, troll DNA it would seem.. ;)

While some of you might hate the language, nobody is going to abandon it.. not within my life time.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
B.E
Member
Member
Posts: 275
Joined: Sat Oct 21, 2006 5:29 pm
Location: Brisbane Australia
Contact:

Post by B.E »

C/C++ is language that is a level lower than most languages, but has then platform independence that assembly doesn't. As such things like pointers and basic data types make the language difficult to use.

And because of it low levelness we use it in system level applications (i.e OSes, games, servers, etc...).
Image
Microsoft: "let everyone run after us. We'll just INNOV~1"
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Brynet-Inc wrote:2) Microsoft Windows, The unfortunate leader in the OS market, was also written in C/C++.
Most latest Apple software (including large sections of OS/X) uses Objective-C.
My OS is Perception.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Craze Frog wrote:
MessiahAndrw wrote:
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 }.
$ also requires AltGr, +4 this time.
I think you need a new keyboard.

Anyway, how is that really much for difficult than typing Shift+4 for $ and shift+[ for {?
My OS is Perception.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

This is turning into a C v ASM topic and we know where that leads.
Theres good and bad things in all languages, in the end it comes down to what the person doing the coding wants to use.

But all i can say is there will alway be a place for ASM, but this may not be the case with C. Take linux as a example, it was always a C world, but if you see all the latest stuff coming out for linux, i would say that less than 20% is written in C.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

MessiahAndrw wrote:
Brynet-Inc wrote:2) Microsoft Windows, The unfortunate leader in the OS market, was also written in C/C++.
Most latest Apple software (including large sections of OS/X) uses Objective-C.
The kernel and several base utilities, do not.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Dex wrote:Take linux as a example, it was always a C world, but if you see all the latest stuff coming out for linux, i would say that less than 20% is written in C.
And where do you get those statistics? a giant talking rabbit named Bob perhaps? They must be accurate.. :roll:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

Brynet-Inc wrote:a giant talking rabbit named Bob perhaps?
My God! You know Bob!?

I think Dex is correct, however. As more and more languages recruit more and more developers, the amount of people writing applications in C diminishes. C++ alone has put a major decrease on C developers (Think KDE), and scripting languages promising to put the fun back into programming have captured those wanting to just program. Moreover, this isn't even in reference to Windows land where .NET Has sucked countless developers into its height, and Web 2.0 country where Rails is spreading worse than the flu. If you haven't noticed, C is losing in the mainstream application development world, for the most part. (Let's not get all technical here and talk about the interfacing spreading code, and all that jazz about 'fast' video games - which, by he way, mostly use C++.)
C8H10N4O2 | #446691 | Trust the nodes.
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post by Craze Frog »

MessiahAndrw wrote:
Craze Frog wrote:
MessiahAndrw wrote: You can use $( and $) instead of { and }.
$ also requires AltGr, +4 this time.
I think you need a new keyboard.

Anyway, how is that really much for difficult than typing Shift+4 for $ and shift+[ for {?
I think you need a new keyboard.
There's nothing wrong with the keyboard (except that the AltGr key is broken!!).
Anyway, how is that really much for difficult than typing Shift+4 for $ and shift+[ for {?
It's a much more unconfortable motion. Also, I don't have a [ key either, I already need AltGr for that as well.
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

What kind of keyboard do you have?
The cake is a lie | rackbits.com
Post Reply