By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,739 Members | 1,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,739 IT Pros & Developers. It's quick & easy.

C is too old? opinions?

P: n/a
Hi...

I am relativ new to the impressive and powerfull C language, but i
thinks it is obsolete...

The idea with header/source files where methods can clash into
eachother i don't like... Look at C# which is much cleaner with
namespaces.

Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?

Something like:

a_source_file.c:

namespace SomeName(.SomeName)
{
area Stack
{
private int[] myStack;

private void someMethod() {};

public void push(int i) {};
public int pop() {};
}
}

another_source_file.c:

using SomeName(.SomeName);

int main(int argc, char[] *argv)
{
Stack.push(10);
System.printf(Stack.pop());
}

I'm really annoyed ;) Is im the only own with that point of view?

If i was a really good programmer (which i'm not... yet! ;)) i would
developed a compiler and a much more simple (but still impressive and
powerfull) c...

Best and kindest regards
Lasse Espeholt

Jul 12 '06 #1
Share this Question
Share on Google+
187 Replies


P: n/a
Lasse Espeholt writes:
Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?
It sounds like you can get what you want from C++.
--
"Some people *are* arrogant, and others read the FAQ."
--Chris Dollin
Jul 12 '06 #2

P: n/a
On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
Lasse Espeholt writes:
>Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?

It sounds like you can get what you want from C++.
There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?

Jul 12 '06 #3

P: n/a
In article <44***********************@dread16.news.tele.dk> ,
<Lasse Espeholtwrote:
>Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?
Please read about the "static" storage qualifier, and about "file scope".

--
Programming is what happens while you're busy making other plans.
Jul 12 '06 #4

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
>Lasse Espeholt writes:
>>Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?

It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?
I'm not sure what you mean by that. No, you shouldn't eliminate header
files. C++ has what you want with namespaces. What is "still recommended,
right"?

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #5

P: n/a
On 2006-07-12 23:44:41 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
>>Lasse Espeholt writes:

Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?

It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?

I'm not sure what you mean by that. No, you shouldn't eliminate header
files. C++ has what you want with namespaces. What is "still recommended,
right"?
I thought that header issen't nessesary in c++ but recommended, but i'm
not a c++ developer so...

I'm looking for the simplicity of c# without objects ;)

Jul 12 '06 #6

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
Hi...

I am relativ new to the impressive and powerfull C language, but i
thinks it is obsolete...
Nah; in fact, a new standard was released around 1999, and it still
isn't implemented widely because the features from 1989 are still
perfectly useful today!
The idea with header/source files where methods can clash into
eachother i don't like... Look at C# which is much cleaner with
namespaces.
C++ has namespaces. You could try over there.
Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?
If you qualify a function with `static', it isn't visible outside
of the file that it is defined in.
>
I'm really annoyed ;) Is im the only own with that point of view?
Around here, probably. :-)
If i was a really good programmer (which i'm not... yet! ;)) i would
developed a compiler and a much more simple (but still impressive and
powerfull) c...
There was a guy who did that... Bjarne Strousup, they called him.
(Although `they' knew how to spell his name properly.)

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #7

P: n/a
Lasse Espeholt writes:
On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
>Lasse Espeholt writes:
>>Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?
It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?
I don't think there is a practical way to write large C or C++
programs without using header files. If you want to avoid header
files entirely, you'll need to move to something like C# or Java.
--
"Some programming practices beg for errors;
this one is like calling an 800 number
and having errors delivered to your door."
--Steve McConnell
Jul 12 '06 #8

P: n/a
Lasse Espeholt said:
Hi...

I am relativ new to the impressive and powerfull C language, but i
thinks it is obsolete...
Fine, so don't use it. Nobody is forcing you to.
The idea with header/source files where methods can clash into
eachother i don't like...
Since C doesn't have methods, the problem doesn't arise.
Look at C# which is much cleaner with namespaces.
No thanks.
Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?
Because the language definition doesn't say it has.

<snip>
If i was a really good programmer (which i'm not... yet! ;)) i would
developed a compiler and a much more simple (but still impressive and
powerfull) c...
Nobody is stopping you.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jul 12 '06 #9

P: n/a
Lasse Espeholt said:

<snip>
I'm looking for the simplicity of c# without objects ;)
Then C is the wrong place to look. C has objects. So does C++, so it's no
good looking there, either.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jul 12 '06 #10

P: n/a
On 2006-07-12 23:44:20 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
Lasse Espeholt writes:
>On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
>>Lasse Espeholt writes:

Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?
It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?

I don't think there is a practical way to write large C or C++
programs without using header files. If you want to avoid header
files entirely, you'll need to move to something like C# or Java.
If C# can, C also can ;).... i can't see any problems ?

Jul 12 '06 #11

P: n/a
On 2006-07-12 23:48:41 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>Hi...

I am relativ new to the impressive and powerfull C language, but i
thinks it is obsolete...

Nah; in fact, a new standard was released around 1999, and it still
isn't implemented widely because the features from 1989 are still
perfectly useful today!
>The idea with header/source files where methods can clash into
eachother i don't like... Look at C# which is much cleaner with
namespaces.

C++ has namespaces. You could try over there.
>Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?

If you qualify a function with `static', it isn't visible outside
of the file that it is defined in.
>>
I'm really annoyed ;) Is im the only own with that point of view?

Around here, probably. :-)
>If i was a really good programmer (which i'm not... yet! ;)) i would
developed a compiler and a much more simple (but still impressive and
powerfull) c...

There was a guy who did that... Bjarne Strousup, they called him.
(Although `they' knew how to spell his name properly.)
yeah.... Bjarne Stroustrup is from my planet (Denmark, NOT the swedish
capital) ;)

hhm... i'm sadly the only one whom does not like C structure very much :D

Jul 12 '06 #12

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12 23:44:41 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
>On 2006-07-12, Lasse Espeholt <Lassewrote:
>>On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:

Lasse Espeholt writes:

Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?

It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?

I'm not sure what you mean by that. No, you shouldn't eliminate header
files. C++ has what you want with namespaces. What is "still recommended,
right"?

I thought that header issen't nessesary in c++ but recommended, but i'm
not a c++ developer so...
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #13

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12 23:44:20 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
>Lasse Espeholt writes:
>>On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:

Lasse Espeholt writes:

Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?
It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?

I don't think there is a practical way to write large C or C++
programs without using header files. If you want to avoid header
files entirely, you'll need to move to something like C# or Java.

If C# can, C also can ;).... i can't see any problems ?
Untrue. Think carefully about that statement, and consider why C and
C# are different languages.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #14

P: n/a
On 2006-07-12 23:59:02 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>On 2006-07-12 23:44:20 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:
>>Lasse Espeholt writes:

On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:

Lasse Espeholt writes:
>
>Why has C not namespaces and a "area idea" where some methods and
>fields could be hidden from the outside?
It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?

I don't think there is a practical way to write large C or C++
programs without using header files. If you want to avoid header
files entirely, you'll need to move to something like C# or Java.

If C# can, C also can ;).... i can't see any problems ?

Untrue. Think carefully about that statement, and consider why C and
C# are different languages.
I know why they are different, but in this case it is true

Jul 12 '06 #15

P: n/a
On 2006-07-12 23:52:55 +0200, Richard Heathfield
<in*****@invalid.invalidsaid:
Lasse Espeholt said:

<snip>
>I'm looking for the simplicity of c# without objects ;)

Then C is the wrong place to look. C has objects. So does C++, so it's
no good looking there, either.
Object-orientated, classes then....

Jul 12 '06 #16

P: n/a
On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>On 2006-07-12 23:44:41 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
>>On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12 23:29:50 +0200, Ben Pfaff <bl*@cs.stanford.edusaid:

Lasse Espeholt writes:
>
>Why has C not namespaces and a "area idea" where some methods and
>fields could be hidden from the outside?
>
It sounds like you can get what you want from C++.

There is still the header issue which i'm not a fan of... I can get rid
of header files but it is still recommended, right?
I'm not sure what you mean by that. No, you shouldn't eliminate header
files. C++ has what you want with namespaces. What is "still recommended,
right"?

I thought that header issen't nessesary in c++ but recommended, but i'm
not a c++ developer so...

Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.
I think its workds great in other languages...?

Jul 12 '06 #17

P: n/a
On 2006-07-12 23:52:12 +0200, Richard Heathfield
<in*****@invalid.invalidsaid:
Lasse Espeholt said:
>Hi...

I am relativ new to the impressive and powerfull C language, but i
thinks it is obsolete...

Fine, so don't use it. Nobody is forcing you to.
>The idea with header/source files where methods can clash into
eachother i don't like...

Since C doesn't have methods, the problem doesn't arise.
>Look at C# which is much cleaner with namespaces.

No thanks.
>Why has C not namespaces and a "area idea" where some methods and
fields could be hidden from the outside?

Because the language definition doesn't say it has.

<snip>
>If i was a really good programmer (which i'm not... yet! ;)) i would
developed a compiler and a much more simple (but still impressive and
powerfull) c...

Nobody is stopping you.
nobody forcing me - no, but in some cases C is a wonderfull
language.... don't get me wrong... i don't hate the language... it is
infact one of my favourites but i think some things could be done
better... i think it has some things there issent nessesary in modern
languages... for example header files...

hhm... it is correct that nobody is stopping me, but i stops myself...
I'm not good enogh....

best regards

Jul 12 '06 #18

P: n/a
Lasse Espeholt wrote:
Hi...

I am relativ new to the impressive and powerfull C language, but i
thinks it is obsolete...
What you think is largely irrelevant. C isn't going anywhere, and is
still the language of choice for many applications.
The idea with header/source files where methods can clash into
eachother i don't like... Look at C# which is much cleaner with
namespaces.
Gawd. If you must have that, C++ is a far better idea.

Brian
Jul 12 '06 #19

P: n/a
Lasse Espeholt wrote:
On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.all>
said:
>>
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.


I think its workds great in other languages...?
They have rules to enforce application layout and/or complex object
names that include a search path. What would you rather have:

path.to.some.external.wibble.a();

or

#include "wibble.h"

a();

--
Ian Collins.
Jul 12 '06 #20

P: n/a
On Wed, 12 Jul 2006 23:55:02 +0200, in comp.lang.c , Lasse Espeholt
wrote:
>
If C# can, C also can ;).... i can't see any problems ?
The only problem is that C# is a different language. Whats your point?
If you want these features, use a language that has them.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 12 '06 #21

P: n/a
On Wed, 12 Jul 2006 23:47:45 +0200, in comp.lang.c , Lasse Espeholt
wrote:
>
I thought that header issen't nessesary in c++ but recommended, but i'm
not a c++ developer so...
Headers aren't necessary in C or C++, if you don't mind declaring
absolutely everything yourself, including all the system-level
interfaces and internal structs required by IO routines.
>I'm looking for the simplicity of c# without objects ;)
What makes you think that C# doesn't have all this too? It just hidden
differently.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 12 '06 #22

P: n/a
On 2006-07-13 00:19:03 +0200, Ian Collins <ia******@hotmail.comsaid:
Lasse Espeholt wrote:
>On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.all>
said:
>>>
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.


I think its workds great in other languages...?
They have rules to enforce application layout and/or complex object
names that include a search path. What would you rather have:

path.to.some.external.wibble.a();

or

#include "wibble.h"

a();
I like to have namespaces and using... ;)

Jul 12 '06 #23

P: n/a
On 2006-07-13 00:15:37 +0200, "Default User" <de***********@yahoo.comsaid:
Lasse Espeholt wrote:
>Hi...

I am relativ new to the impressive and powerfull C language, but i
thinks it is obsolete...

What you think is largely irrelevant. C isn't going anywhere, and is
still the language of choice for many applications.
>The idea with header/source files where methods can clash into
eachother i don't like... Look at C# which is much cleaner with
namespaces.

Gawd. If you must have that, C++ is a far better idea.

Brian
better but still not perfect...
:)

Jul 12 '06 #24

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
>On 2006-07-12, Lasse Espeholt <Lassewrote:
>>On 2006-07-12, Andrew Poelstra <ap*******@nowhereat.allsaid:
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?
A) Stop ending all of your statements with ellipses and question marks.
B) I don't think it works well in other languages; it's much nicer to
read a header to find the prototype of a function than to have to
find the definition, or documentation, or wherever else you might
find help.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #25

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12 23:59:02 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
>On 2006-07-12, Lasse Espeholt <Lassewrote:
>>If C# can, C also can ;).... i can't see any problems ?

Untrue. Think carefully about that statement, and consider why C and
C# are different languages.

I know why they are different, but in this case it is true
Please tell me a practical way to write a large C program without any
headers.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #26

P: n/a
On 2006-07-13 00:21:25 +0200, Mark McIntyre <ma**********@spamcop.netsaid:
On Wed, 12 Jul 2006 23:55:02 +0200, in comp.lang.c , Lasse Espeholt
wrote:
>>
If C# can, C also can ;).... i can't see any problems ?

The only problem is that C# is a different language. Whats your point?
If you want these features, use a language that has them.
I dont want arything from c#... i don't want a JIT for example... i
want C with namespaces, usings, and a "area" thing... :)

Jul 12 '06 #27

P: n/a
Lasse Espeholt wrote:
On 2006-07-13 00:19:03 +0200, Ian Collins <ia******@hotmail.comsaid:
>Lasse Espeholt wrote:
>>On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.all>
said:
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?
They have rules to enforce application layout and/or complex object
names that include a search path. What would you rather have:

path.to.some.external.wibble.a();

or

#include "wibble.h"

a();


I like to have namespaces and using... ;)
So what's the difference in typing a few includes or the equivalent
using directives?

--
Ian Collins.
Jul 12 '06 #28

P: n/a
On 2006-07-13 00:23:04 +0200, Mark McIntyre <ma**********@spamcop.netsaid:
On Wed, 12 Jul 2006 23:47:45 +0200, in comp.lang.c , Lasse Espeholt
wrote:
>>
I thought that header issen't nessesary in c++ but recommended, but i'm
not a c++ developer so...

Headers aren't necessary in C or C++, if you don't mind declaring
absolutely everything yourself, including all the system-level
interfaces and internal structs required by IO routines.
>I'm looking for the simplicity of c# without objects ;)

What makes you think that C# doesn't have all this too? It just hidden
differently.
C# has namespaces, usings, classes

C has includes + some other things

I want a C with namespaces, usings, a "area" thing and without header files

A thing i hate about header files is the prevention from dobble
includes (#ifndef __FILE_H_)... i know there are #import, but nobody
uses it

Jul 12 '06 #29

P: n/a
Andrew Poelstra wrote:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>>On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:

>>>On 2006-07-12, Lasse Espeholt <Lassewrote:

On 2006-07-12, Andrew Poelstra <ap*******@nowhereat.allsaid:

Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?

A) Stop ending all of your statements with ellipses and question marks.
B) I don't think it works well in other languages; it's much nicer to
read a header to find the prototype of a function than to have to
find the definition, or documentation, or wherever else you might
find help.
I'd second both points.

I've been doing a lot of PHP recently, and it is a real pain not having
a header like summary of an object's member functions. So much so, I
end up creating interfaces as a header replacement.

--
Ian Collins.
Jul 12 '06 #30

P: n/a
On 2006-07-13 00:27:05 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>On 2006-07-12 23:59:02 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
>>On 2006-07-12, Lasse Espeholt <Lassewrote:
If C# can, C also can ;).... i can't see any problems ?
Untrue. Think carefully about that statement, and consider why C and
C# are different languages.

I know why they are different, but in this case it is true

Please tell me a practical way to write a large C program without any
headers.
Simple, as i said, namespaces and usings so instead of:

#include "myfunctions.h"

you write

using myfunctions;

Jul 12 '06 #31

P: n/a
On 2006-07-13 00:26:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
>>On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12, Andrew Poelstra <ap*******@nowhereat.allsaid:
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?

A) Stop ending all of your statements with ellipses and question marks.
B) I don't think it works well in other languages; it's much nicer to
read a header to find the prototype of a function than to have to
find the definition, or documentation, or wherever else you might
find help.
A. Sorry for my formatting, i will try not to use question marks

B. In a modern IDE all the functions is listed.

Jul 12 '06 #32

P: n/a
On 2006-07-13 00:29:04 +0200, Ian Collins <ia******@hotmail.comsaid:
Lasse Espeholt wrote:
>On 2006-07-13 00:19:03 +0200, Ian Collins <ia******@hotmail.comsaid:
>>Lasse Espeholt wrote:

On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.all>
said:

>
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?

They have rules to enforce application layout and/or complex object
names that include a search path. What would you rather have:

path.to.some.external.wibble.a();

or

#include "wibble.h"

a();


I like to have namespaces and using... ;)
So what's the difference in typing a few includes or the equivalent
using directives?
with includes you risk that the files have functions there have the same name.

with includes you shall write "ifndef __FILE_H__" otherwise you could
end up in trouble.

Jul 12 '06 #33

P: n/a
On 2006-07-13 00:31:23 +0200, Ian Collins <ia******@hotmail.comsaid:
Andrew Poelstra wrote:
>On 2006-07-12, Lasse Espeholt <Lassewrote:
>>On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:

On 2006-07-12, Andrew Poelstra <ap*******@nowhereat.allsaid:

Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?

A) Stop ending all of your statements with ellipses and question marks.
B) I don't think it works well in other languages; it's much nicer to
read a header to find the prototype of a function than to have to
find the definition, or documentation, or wherever else you might
find help.
I'd second both points.

I've been doing a lot of PHP recently, and it is a real pain not having
a header like summary of an object's member functions. So much so, I
end up creating interfaces as a header replacement.
Maybe you should try a better IDE... with the Visual Studio and ASP.net
(c#, java,...) all methods(functions, procedure and what they are
called) is listed...

But i must amitted that i have'nt meet any well written PHP IDE, so
from that point of view i will agree with you....

Jul 12 '06 #34

P: n/a

<Lasse Espeholtwrote in message
news:44***********************@dread16.news.tele.d k...
Hi...

I am relativ new to the impressive and powerfull C language, but i thinks
it is obsolete...

The idea with header/source files where methods can clash into eachother i
don't like... Look at C# which is much cleaner with namespaces.

Why has C not namespaces and a "area idea" where some methods and fields
could be hidden from the outside?
It does: static methods are hidden to the world outside the file in which
they are defined.

<snip>>
Best and kindest regards
Lasse Espeholt
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project
Jul 12 '06 #35

P: n/a
Lasse Espeholt wrote:
On 2006-07-13 00:29:04 +0200, Ian Collins <ia******@hotmail.comsaid:
>Lasse Espeholt wrote:
>>I like to have namespaces and using... ;)
So what's the difference in typing a few includes or the equivalent
using directives?


with includes you risk that the files have functions there have the same
name.
That's why C++ added namespaces, the only remedy in C is care.
with includes you shall write "ifndef __FILE_H__" otherwise you could
end up in trouble.
I don't, my boilerplate generator does. In your case, I'm sure your
modern IDE would do the same.

--
Ian Collins.
Jul 12 '06 #36

P: n/a
On Thu, 13 Jul 2006 00:31:02 +0200, Lasse Espeholt wrote:
>
I want a C with namespaces, usings, a "area" thing and without header files
It's becoming obvious that whatever it is that you want, it isn't C. I
suggest that you identify the language you do want, and then find a
suitable place to discuss it (it won't be here.)

--
Al Balmer
Sun City, AZ
Jul 12 '06 #37

P: n/a
On Wed, 12 Jul 2006, Richard Heathfield wrote:
Lasse Espeholt said:

<snip>
>I'm looking for the simplicity of c# without objects ;)
[It is very clear that Lasse is talking about objects in the
C# sense here.]

[Richard Heathfield continued:]
Then C is the wrong place to look. C has objects. So does C++, so it's no
good looking there, either.
While C does have objects, its definition (``object: a
region of data storage in the execution environment, the contents
of which can represent values'', C90/C99 3.14) is totally
different from that of C# which was the context of this subthread
(``The object class type is the ultimate base class of all other
types. Every type in C# directly or indirectly derives from the
object class type'', ECMA-334 11.2.2).

By comparing C objects with C# objects, one is making a
faulty analogy (also known as ``comparing apples with oranges'').

Better is to write that C# is off-topic here without making
that gratuitous (and logically unsound) remark.

Tak-Shing
Jul 12 '06 #38

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
nobody forcing me - no, but in some cases C is a wonderfull
language.... don't get me wrong... i don't hate the language... it is
infact one of my favourites but i think some things could be done
better... i think it has some things there issent nessesary in modern
languages... for example header files...

hhm... it is correct that nobody is stopping me, but i stops myself...
I'm not good enogh....
Well, then learn and become good enough. Also, please use proper
capitalization and punctuation.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #39

P: n/a
On 2006-07-13 00:40:42 +0200, Ian Collins <ia******@hotmail.comsaid:
Lasse Espeholt wrote:
>On 2006-07-13 00:29:04 +0200, Ian Collins <ia******@hotmail.comsaid:
>>Lasse Espeholt wrote:

I like to have namespaces and using... ;)

So what's the difference in typing a few includes or the equivalent
using directives?


with includes you risk that the files have functions there have the same
name.
That's why C++ added namespaces, the only remedy in C is care.
>with includes you shall write "ifndef __FILE_H__" otherwise you could
end up in trouble.
I don't, my boilerplate generator does. In your case, I'm sure your
modern IDE would do the same.
Hmm, it seems like we come from two different worlds, but there is room
enogh to both opinions :) but i must amit that i throught many had the
same opinion as i do :)

Jul 12 '06 #40

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-13 00:29:04 +0200, Ian Collins <ia******@hotmail.comsaid:
>Lasse Espeholt wrote:
>>On 2006-07-13 00:19:03 +0200, Ian Collins <ia******@hotmail.comsaid:

I like to have namespaces and using... ;)
So what's the difference in typing a few includes or the equivalent
using directives?

with includes you risk that the files have functions there have the same name.

with includes you shall write "ifndef __FILE_H__" otherwise you could
end up in trouble.
Well, you may very well end up in trouble typing that. Invading the
implementation's namespace is a no-no. (Using _ followed by another
_ or an UPPERCASE letter is the implementation's namespace).

What exactly is wrong with typing this?:

#ifndef FILE_H_
#define FILE_H_

....

#endif

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #41

P: n/a
On Wed, 12 Jul 2006 23:57:15 +0200, Lasse Espeholt wrote:
>yeah.... Bjarne Stroustrup is from my planet (Denmark, NOT the swedish
capital) ;)
What a coincidence! He's from my planet, too.
>
hhm... i'm sadly the only one whom does not like C structure very much :D
In case you haven't noticed, this is a newsgroup about the standard C
language. Many of the people here do like C and most of its features.
Here, we really don't discuss other languages or what the C language
might be turned into, we discuss it as it is now. If you want to
discuss enhancement of the C language, perhaps you should visit
comp.std.c.

--
Al Balmer
Sun City, AZ
Jul 12 '06 #42

P: n/a
Lasse Espeholt wrote:
On 2006-07-13 00:31:23 +0200, Ian Collins <ia******@hotmail.comsaid:
>>
I've been doing a lot of PHP recently, and it is a real pain not having
a header like summary of an object's member functions. So much so, I
end up creating interfaces as a header replacement.


Maybe you should try a better IDE... with the Visual Studio and ASP.net
(c#, java,...) all methods(functions, procedure and what they are
called) is listed...
I don't like IDEs, I'm happy with my editor and I don't use windows.
--
Ian Collins.
Jul 12 '06 #43

P: n/a
On 2006-07-13 00:42:00 +0200, Al Balmer <al******@att.netsaid:
On Thu, 13 Jul 2006 00:31:02 +0200, Lasse Espeholt wrote:
>>
I want a C with namespaces, usings, a "area" thing and without header files
It's becoming obvious that whatever it is that you want, it isn't C. I
suggest that you identify the language you do want, and then find a
suitable place to discuss it (it won't be here.)
I want C, i don't hate C, i just think things could have been done
better :), fine, end of discussion

Jul 12 '06 #44

P: n/a
On 2006-07-13 00:42:36 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>nobody forcing me - no, but in some cases C is a wonderfull
language.... don't get me wrong... i don't hate the language... it is
infact one of my favourites but i think some things could be done
better... i think it has some things there issent nessesary in modern
languages... for example header files...

hhm... it is correct that nobody is stopping me, but i stops myself...
I'm not good enogh....

Well, then learn and become good enough. Also, please use proper
capitalization and punctuation.
I'm not the master in english nor languages in generel. I try...

Jul 12 '06 #45

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-13 00:31:23 +0200, Ian Collins <ia******@hotmail.comsaid:
>Andrew Poelstra wrote:
>>On 2006-07-12, Lasse Espeholt <Lassewrote:

On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
On 2006-07-12, Lasse Espeholt <Lassewrote:
>
>On 2006-07-12, Andrew Poelstra <ap*******@nowhereat.allsaid:
>
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?
A) Stop ending all of your statements with ellipses and question marks.
B) I don't think it works well in other languages; it's much nicer to
read a header to find the prototype of a function than to have to
find the definition, or documentation, or wherever else you might
find help.
I'd second both points.

I've been doing a lot of PHP recently, and it is a real pain not having
a header like summary of an object's member functions. So much so, I
end up creating interfaces as a header replacement.
I comment C-style prototypes up at the top of my listings. If I have a lot
of functions, I'll write a "header" full of comments and include that. (I
prefer not to because it isn't very PHP-like, and friends usually edit my
PHP scripts a lot more often than I do.)
>
Maybe you should try a better IDE... with the Visual Studio and ASP.net
(c#, java,...) all methods(functions, procedure and what they are
called) is listed...
http://www.charlespetzold.com/etc/Do...otTheMind.html

I'm not installing a GUI just so that I can have an IDE. I can't stand
either one of them. vi works just fine, thank you.
But i must amitted that i have'nt meet any well written PHP IDE, so
from that point of view i will agree with you....
/Please/ start using proper punctuation.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #46

P: n/a
Andrew Poelstra said:

<snip>
>
Please tell me a practical way to write a large C program without any
headers.
Easy. Write a large C program with headers. Run it through the preprocessor.
The output is a large C program without headers.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jul 12 '06 #47

P: n/a
On 2006-07-13 00:47:23 +0200, Ian Collins <ia******@hotmail.comsaid:
Lasse Espeholt wrote:
>On 2006-07-13 00:31:23 +0200, Ian Collins <ia******@hotmail.comsaid:
>>>
I've been doing a lot of PHP recently, and it is a real pain not having
a header like summary of an object's member functions. So much so, I
end up creating interfaces as a header replacement.


Maybe you should try a better IDE... with the Visual Studio and ASP.net
(c#, java,...) all methods(functions, procedure and what they are
called) is listed...
I don't like IDEs, I'm happy with my editor and I don't use windows.
Fair

Jul 12 '06 #48

P: n/a
On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-13 00:26:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:
>On 2006-07-12, Lasse Espeholt <Lassewrote:
>>On 2006-07-12 23:58:00 +0200, Andrew Poelstra <ap*******@nowhereat.allsaid:

On 2006-07-12, Lasse Espeholt <Lassewrote:
On 2006-07-12, Andrew Poelstra <ap*******@nowhereat.allsaid:
Headers aren't technically necessary in C, either... it's still a
terrible idea to try and get along without them.

I think its workds great in other languages...?

A) Stop ending all of your statements with ellipses and question marks.
B) I don't think it works well in other languages; it's much nicer to
read a header to find the prototype of a function than to have to
find the definition, or documentation, or wherever else you might
find help.

A. Sorry for my formatting, i will try not to use question marks
Thank you. Also try not to use ellipses, and do use other punctuation
correctly.
B. In a modern IDE all the functions is listed.
http://www.charlespetzold.com/etc/Do...otTheMind.html

Interestingly enough, I've typed that out twice for you, and now I have
it memorized. Not only that, but I can type it faster than I could click
on Bookmarks, or Favorites, or whatever the term is on the browser I'm
using.

Kinda proves the point of the article, huh. ;-)

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 12 '06 #49

P: n/a
Tak-Shing Chan said:
On Wed, 12 Jul 2006, Richard Heathfield wrote:
>Lasse Espeholt said:

<snip>
>>I'm looking for the simplicity of c# without objects ;)

[It is very clear that Lasse is talking about objects in the
C# sense here.]
Not so. In comp.lang.c, the word "object" has a clearly-defined meaning. If
he isn't using the word in that sense, his usage is off-topic. Since I
cannot believe he would be so ungentlemanly as to post off-topic material,
I deduce that he is using the word with its topical, C-related meaning.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jul 12 '06 #50

187 Replies

This discussion thread is closed

Replies have been disabled for this discussion.