Who here doesn't use C and why?
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.
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
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Troll!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
I should add that I don't use C.
I use C++ because I wanted to use namespaces, streams, and templates.
I use C++ because I wanted to use namespaces, streams, and templates.
The cake is a lie | rackbits.com
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.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.
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 dOn'T sEe WhY eNfOrCiNg A cErTaIn CaPiTaLiZaTiOn CoUlD bE hElPfUl FoR cOnSiStEnCy Or ReAdAbIlItY, nO.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
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 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 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.
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).-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
- crazygray1
- Member
- Posts: 168
- Joined: Thu Nov 22, 2007 7:18 pm
- Location: USA,Hawaii,Honolulu(Seriously)
I find that interesting, do you have it on linux? If so, could I try it out?Tyler wrote: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.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.
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.
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Then always type variable names in the same case?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
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.
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.Candy wrote:I dOn'T sEe WhY eNfOrCiNg A cErTaIn CaPiTaLiZaTiOn CoUlD bE hElPfUl FoR cOnSiStEnCy Or ReAdAbIlItY, nO.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
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.
Wtf, man Are you drunk or something?Candy wrote: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 header/source thing. I just don't like it. The UCSD pascal unit convention goes much better to my taste of code/interface seperation
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.
Delphi is getting enterprise-ish, too much .Net and databases. At that point Freepascal is getting ahead. It recently got beta support for generic typesIs 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).-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
FYI, for namespace.ucosty wrote:I should add that I don't use C.
I use C++ because I wanted to use namespaces, streams, and templates.
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
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
- crazygray1
- Member
- Posts: 168
- Joined: Thu Nov 22, 2007 7:18 pm
- Location: USA,Hawaii,Honolulu(Seriously)