C is too old? opinions?
  Home FAQ Contact Sign in
comp.lang.c only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.c Profile…
 Up
C is too old? opinions?         


Date: Jul 12, 2006 14:26

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() {};
Show full article (0.98Kb)
199 Comments
Re: C is too old? opinions?         


Author: Ben Pfaff
Date: Jul 12, 2006 14:29

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
109 Comments
Re: C is too old? opinions?         


Date: Jul 12, 2006 14:38

On 2006-07-12 23:29:50 +0200, Ben Pfaff cs.stanford.edu> said:
> 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?
106 Comments
Re: C is too old? opinions?         


Author: Walter Roberson
Date: Jul 12, 2006 14:43

In article <44b568f1$0$20239$edfadb0f@dread16.news.tele.dk>,
wrote:
>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.
no comments
Re: C is too old? opinions?         


Author: Andrew Poelstra
Date: Jul 12, 2006 14:44

On 2006-07-12, Lasse Espeholt wrote:
> On 2006-07-12 23:29:50 +0200, Ben Pfaff cs.stanford.edu> said:
>
>> 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"?
Show full article (0.77Kb)
39 Comments
Re: C is too old? opinions?         


Date: Jul 12, 2006 14:47

On 2006-07-12 23:44:41 +0200, Andrew Poelstra said:
> On 2006-07-12, Lasse Espeholt wrote:
>> On 2006-07-12 23:29:50 +0200, Ben Pfaff cs.stanford.edu> said:
>>
>>> 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"?
Show full article (0.87Kb)
34 Comments
Re: C is too old? opinions?         


Author: Andrew Poelstra
Date: Jul 12, 2006 14:48

On 2006-07-12, Lasse Espeholt wrote:
> 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.
Show full article (1.29Kb)
2 Comments
Re: C is too old? opinions?         


Author: Ben Pfaff
Date: Jul 12, 2006 14:44

Lasse Espeholt writes:
> On 2006-07-12 23:29:50 +0200, Ben Pfaff cs.stanford.edu> said:
>
>> 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
15 Comments
Re: C is too old? opinions?         


Author: Richard Heathfield
Date: Jul 12, 2006 14:52

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.


> 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.
Show full article (0.92Kb)
4 Comments
Re: C is too old? opinions?         


Author: Richard Heathfield
Date: Jul 12, 2006 14:52

Lasse Espeholt said:


> 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)
1 Comment
1 2 3 4 5 6 7 8 9