C is too old? opinions?

L

Lasse Espeholt

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
 
B

Ben Pfaff

Lasse said:
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++.
 
L

Lasse Espeholt

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?
 
W

Walter Roberson

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".
 
B

Ben Pfaff

Lasse said:
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.
 
A

Andrew Poelstra

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"?
 
L

Lasse Espeholt

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 ;)
 
A

Andrew Poelstra

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.)
 
R

Richard Heathfield

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.
 
R

Richard Heathfield

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.
 
L

Lasse Espeholt

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 ?
 
L

Lasse Espeholt

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!


C++ has namespaces. You could try over there.


If you qualify a function with `static', it isn't visible outside
of the file that it is defined in.


Around here, probably. :)


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
 
A

Andrew Poelstra

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.
 
A

Andrew Poelstra

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.
 
L

Lasse Espeholt

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
 
L

Lasse Espeholt

Lasse Espeholt said:



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....
 
L

Lasse Espeholt

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...?
 
L

Lasse Espeholt

Lasse Espeholt said:


Fine, so don't use it. Nobody is forcing you to.


Since C doesn't have methods, the problem doesn't arise.


No thanks.


Because the language definition doesn't say it has.



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
 
D

Default User

Lasse said:
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
 
F

Fred Kleinschmidt

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top