Who here doesn't use C and why?

Programming, for all ages and all languages.
Post Reply
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

You don't really nead headers. They just make it easier to share prototypes around without having to retype them in every source file.

Im sure the only reason that you need prototypes is because C/C++ compilers only consider programs file at a time. The compiler needs hints showing it how to arrange things so they come together at the linker stage.
The cake is a lie | rackbits.com
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post by Craze Frog »

Laksen wrote:Things I enjoy about Object Pascal that I seem to lack in C:
-case insensitivity. Really... Is there a need for something like case sensitivity? To me it is a complete annoyance
-The header/source thing. I just don't like it. The UCSD pascal unit convention goes much better to my taste of code/interface seperation
(The following is probably more of a compiler problem)
-basic error checking(overflow, bounds, range, etc). I understand why some people, me included, would like to have them disabled sometimes, but I can disable them easily. Having this feature allows me to code alot faster without having to worry about small problems that might result in bugs later on

I could keep complaining but those were the major points, that didn't have very much with syntax to do :wink:
Troll! :roll:
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

I should add that I don't use C.

I use C++ because I wanted to use namespaces, streams, and templates.
The cake is a lie | rackbits.com
Tyler
Member
Member
Posts: 514
Joined: Tue Nov 07, 2006 7:37 am
Location: York, England

Post by Tyler »

ucosty wrote:You don't really nead headers. They just make it easier to share prototypes around without having to retype them in every source file.

Im sure the only reason that you need prototypes is because C/C++ compilers only consider programs file at a time. The compiler needs hints showing it how to arrange things so they come together at the linker stage.
That's ignores the main advantages of header files. The seperation of Decleration and Implementation as well as the ability to store typedefs, defines and constants in uncompiled files which can be kept in a central store makes sharing basic constructs and interfacing with compiled libraries possible without having to write any interop code and often without having to memorize documentation.

In a situation where you want to share your code, you do, basically, need the header files, and they aren't there just for ease of use.

EDIT: I do use C, but i mostly write my Operating System in Assembly because i am very obsessive about knowing exactly what every byte in my Operating System is and does. However, i wrote my own assembler in order to get all the above advantages and be able to use a single set of headers for both C and Assembly code. I know GAS does this, but i prefer Intel Syntax and most of NASM's constructs, so i was forced to write my own.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Laksen wrote:Things I enjoy about Object Pascal that I seem to lack in C:
-case insensitivity. Really... Is there a need for something like case sensitivity? To me it is a complete annoyance
I dOn'T sEe WhY eNfOrCiNg A cErTaIn CaPiTaLiZaTiOn CoUlD bE hElPfUl FoR cOnSiStEnCy Or ReAdAbIlItY, nO.
-The header/source thing. I just don't like it. The UCSD pascal unit convention goes much better to my taste of code/interface seperation
Make a *big* program for your compiler and tell it to compile it - there's NO way to. Now make a properly written C program of equal or bigger size. It compiles.

The point with headers is that they describe what the C file will contain, without actually writing it (so you get a huge boost in speed on compiling, less mess, more of an "interface" to the file) and you don't auto-include all other files as a header which means that when your filesystem routines compile they don't interfere with your mouse routines. Another point - you can parallel and distributed compile it without a change.

Perhaps it's a good idea to reflect on what Pascal and C were made for. Pascal was intently developed to annoy me (and yes, it's had it's good share), C was developed for huge programs compared to the computers on which they would run. Compared to modern computers, the program size has become extremely diminutive compared to the memory size. At the time C was new, the program would be 100000's to millions of lines of code, with a computer with only a meg of ram or so. Nowadays, the average program is like 5000 lines of code with a computer that can trivially keep 1GB in memory.
-basic error checking(overflow, bounds, range, etc). I understand why some people, me included, would like to have them disabled sometimes, but I can disable them easily. Having this feature allows me to code alot faster without having to worry about small problems that might result in bugs later on
Is intentional in C, in C++ you can make arbitrary types with all kinds of bounds checking that Pascal can't do (but then again, Delphi might be able to).
User avatar
crazygray1
Member
Member
Posts: 168
Joined: Thu Nov 22, 2007 7:18 pm
Location: USA,Hawaii,Honolulu(Seriously)

Post by crazygray1 »

Tyler wrote:
ucosty wrote:You don't really nead headers. They just make it easier to share prototypes around without having to retype them in every source file.

Im sure the only reason that you need prototypes is because C/C++ compilers only consider programs file at a time. The compiler needs hints showing it how to arrange things so they come together at the linker stage.
That's ignores the main advantages of header files. The seperation of Decleration and Implementation as well as the ability to store typedefs, defines and constants in uncompiled files which can be kept in a central store makes sharing basic constructs and interfacing with compiled libraries possible without having to write any interop code and often without having to memorize documentation.

In a situation where you want to share your code, you do, basically, need the header files, and they aren't there just for ease of use.

EDIT: I do use C, but i mostly write my Operating System in Assembly because i am very obsessive about knowing exactly what every byte in my Operating System is and does. However, i wrote my own assembler in order to get all the above advantages and be able to use a single set of headers for both C and Assembly code. I know GAS does this, but i prefer Intel Syntax and most of NASM's constructs, so i was forced to write my own.
I find that interesting, do you have it on linux? If so, could I try it out?
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Laksen wrote:Things I enjoy about Object Pascal that I seem to lack in C:
-case insensitivity. Really... Is there a need for something like case sensitivity? To me it is a complete annoyance
Then always type variable names in the same case?

It's useful anyway, because (I know it's bad programming habit) but I have a few variables labeled thing like "Device" and "device". I really only use this in 2 situations:

If "Device" is a class, and "device" is an instance of the class, or
"Device" is a global or member variable (except I usually use m_device) and "device" is a parameter passed as a function parameter, e.g. "ChangeColour(Colour colour);" uses both situations.
My OS is Perception.
Laksen
Member
Member
Posts: 140
Joined: Fri Nov 09, 2007 3:30 am
Location: Aalborg, Denmark

Post by Laksen »

Candy wrote:
Laksen wrote:Things I enjoy about Object Pascal that I seem to lack in C:
-case insensitivity. Really... Is there a need for something like case sensitivity? To me it is a complete annoyance
I dOn'T sEe WhY eNfOrCiNg A cErTaIn CaPiTaLiZaTiOn CoUlD bE hElPfUl FoR cOnSiStEnCy Or ReAdAbIlItY, nO.
Hah, I seem to have heard that one before. Even in a more childish tone. I wasn't talking about proper capitalization. Any sane programmer capitalises their identifiers properly.
But, I don't really care what way any other programmer capitalizes their local variables or keywords, as long as it doesn't hamper my efficiency.
Candy wrote:
-The header/source thing. I just don't like it. The UCSD pascal unit convention goes much better to my taste of code/interface seperation
Make a *big* program for your compiler and tell it to compile it - there's NO way to. Now make a properly written C program of equal or bigger size. It compiles.
Wtf, man :lol: Are you drunk or something?
I recompile the fpc rtl and my os every time I build my os and it takes less than a second.

I understand your points about distributed/parallel compiling and that jazz. But, in my opinion, I would rather trust my compiler, than my linker, to check if functions exist in another file.
-basic error checking(overflow, bounds, range, etc). I understand why some people, me included, would like to have them disabled sometimes, but I can disable them easily. Having this feature allows me to code alot faster without having to worry about small problems that might result in bugs later on
Is intentional in C, in C++ you can make arbitrary types with all kinds of bounds checking that Pascal can't do (but then again, Delphi might be able to).
Delphi is getting enterprise-ish, too much .Net and databases. At that point Freepascal is getting ahead. It recently got beta support for generic types
Tyler
Member
Member
Posts: 514
Joined: Tue Nov 07, 2006 7:37 am
Location: York, England

Post by Tyler »

crazygray1 wrote:
I find that interesting, do you have it on linux? If so, could I try it out?
Nope, sorry, Windows at the moment, and it isn't open source, because it's embarrassing code :-P.
User avatar
binutils
Member
Member
Posts: 214
Joined: Thu Apr 05, 2007 6:07 am

Post by binutils »

ucosty wrote:I should add that I don't use C.

I use C++ because I wanted to use namespaces, streams, and templates.
FYI, for namespace.

In plan 9, which is written in their own c.
it support private namespaces without any syntactic sugar.
protocol instead of language structure.
http://www.ddj.com/mobile/184404878
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

thats not code level namespacing.
The cake is a lie | rackbits.com
User avatar
binutils
Member
Member
Posts: 214
Joined: Thu Apr 05, 2007 6:07 am

Post by binutils »

ucosty wrote:thats not code level namespacing.
Yes, that is their intention exactly.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

Smalltalk FTW!
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

Colonel Kernel wrote:Smalltalk FTW!
How so very appropriate.
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
crazygray1
Member
Member
Posts: 168
Joined: Thu Nov 22, 2007 7:18 pm
Location: USA,Hawaii,Honolulu(Seriously)

Post by crazygray1 »

I've got wine I can still test it.
Post Reply