C Syntax

C

C# Learner

Why is C syntax so uneasy on the eye?

In its day, was it _really_ designed by snobby programmers to scare away
potential "n00bs"? If so, and after 50+ years of programming research,
why are programming languages still being designed with C's syntax?

These questions drive me insane. Every waking minute...
 
A

Alex Moskalyuk

Why is Chinese syntax so uneasy on the eye?

In its day, was it _really_ designed by snobby linguists to scare away
potential "n00bs"? If so, and after 5000+ years of civilization,
why do Chinese people still using that funny syntax?

These questions drive me insane. Every waking minute...
 
E

Eric Sosman

C# Learner said:
Why is C syntax so uneasy on the eye?

In its day, was it _really_ designed by snobby programmers to scare away
potential "n00bs"? If so, and after 50+ years of programming research,
why are programming languages still being designed with C's syntax?

These questions drive me insane. Every waking minute...

If you want COBOL, you know where to find it.
 
M

Martin Ambuhl

C# Learner said:
Why is C syntax so uneasy on the eye?

Because it's so pretty. That it is "uneasy on [your] eye" is your
problem. Not to worry; there's a solution for your problem. Jesus said
it, and it appears three times in the Gospels:

Matthew 5:29 And if thy right eye offend thee, pluck it out, and cast
it from thee: for it is profitable for thee that one of thy members
should perish, and not that thy whole body should be cast into hell.

Matthew 18:9 And if thine eye offend thee, pluck it out, and cast it
from thee: it is better for thee to enter into life with one eye, rather
than having two eyes to be cast into hell fire.

Mark 9:47 And if thine eye offend thee, pluck it out: it is better for
thee to enter into the kingdom of God with one eye, than having two eyes
to be cast into hell fire:
 
D

Default User

C# Learner said:
Why is C syntax so uneasy on the eye?

In its day, was it _really_ designed by snobby programmers to scare away
potential "n00bs"? If so, and after 50+ years of programming research,
why are programming languages still being designed with C's syntax?

These questions drive me insane. Every waking minute...

Go troll somebody else.

*plonk*




Brian Rodenborn
 
C

C# Learner

Alex said:
Why is Chinese syntax so uneasy on the eye?

<snip>

You make a perfectly valid counter-argument.

I think we can conclude, then, that humans, in general, are a pretty
/stupid/ species. Note that this is /not/ a shallow thought.

Another example showing human stupidity, which is also related to
natural languages, is the fact that there are /so many/ natural
languages spoken by humans. Of cource, more than one natural language
is redundant, and causes problems involved with translation.

By the way, it's nice to see someone actually being able to provide a
decent counter-argument on a newsgroup without having to resort to
name-calling.
 
A

Alex Moskalyuk

Have you ever looked into Perl or Lisp code?

C suddenly starts making perfect sense.

What's uneasy to you? Curly braces, parentheses, keywords, or something
else?
 
M

Martin Dickopp

C# Learner said:
By the way, it's nice to see someone actually being able to provide a
decent counter-argument on a newsgroup without having to resort to
name-calling.

While your original flamebait wasn't particularly an example of decency
on your part, at least have the decency to stop posting off-topic *now*,
please.

If you really believe that the intention of Alex' reply was to start
an elaborate discussion about the Chinese language in comp.lang.c,
I recommend that you stay off Usenet until you have learned to pick up
hints.

Off-topic, therefore Followup-To: poster.

Martin
 
L

Lew Pitcher

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Sosman wrote:
| C# Learner wrote:
|
|> Why is C syntax so uneasy on the eye?
|>
|> In its day, was it _really_ designed by snobby programmers to scare
|> away potential "n00bs"? If so, and after 50+ years of programming
|> research, why are programming languages still being designed with C's
|> syntax?
|>
|> These questions drive me insane. Every waking minute...
|
|
| If you want COBOL, you know where to find it.
|

I resemble that remark! :)

FWIW, if you want a computer language that's really "uneasy on the eye", try
APL or RPG2. Even Lisp isn't very easy to read.

OTOH, I've had to read through pages of Java recently (analysis and design of
a new web component for my corporate masters, requiring review of our current
j2ee web apps), and if Java is the new "readability", then give me C any day.
Worse spaghetti code than you could find in any assembly program. I have no
doubt that C# and C++ are just as bad.




- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAtS6VagVFX4UWr64RAi+RAKCnP8xUHTt6WJpucgZ6Aq6E1fmMoQCgndgX
eofd4o3IJyR9thmZlRXZwPg=
=PX6r
-----END PGP SIGNATURE-----
 
C

C# Learner

Alex said:
Have you ever looked into Perl or Lisp code?

C suddenly starts making perfect sense.

What's uneasy to you? Curly braces, parentheses, keywords, or something
else?

One of the biggest flaws in C syntax, in my opinion, is the required
parentheses for test conditions.

Here's a very simple example:

void Foo
{
if (FooBar(Parse(Process(GetInput())))
DoSomething();
}

Imagine if, instead, we could write the following:

void Foo
{
if FooBar(Parse(Process(GetInput())):
DoSomething();
}

Python uses such a construct for test conditions.

Another nicety about Python is the fact that whitespace is used for
defining code blocks. This makes code much clearer than the equivalent
C code, which requires block being/end markers.

Here's a very simple Python code sample:
http://www.kernelthread.com/hanoi/html/py.html .

Try staring at it for one minute.

After having done so, take a look at this:
http://www.kernelthread.com/hanoi/html/c.html .

Even if one's accustomed to C syntax, the former is still clearer and
easier-to-read, don't you think?

Every time I see code that conforms to C's basic syntax, I cringe; yet I
write such code every day.

Why C? Why?!
 
J

Justin Rogers

As a long time programmer of many languages I've always found the explicit
statement bounding in C to be quite nice. For me it improves readability as
my seasoned internal tokenizer is capable of finding code blocks more quickly
by using the braces and parenthesis than by scanning whitespace. Whitespace
also breaks down quite fast when you start using non fixed width fonts and
mixing tabs and spaces. Arguably you could say, don't do that, but at least
with something of the nature of C and it's explit block scoping you can easily
write a pretty printer and avoid any ambiguity that would otherwise exist.

Take the following excerpt from a Python tutorial:
Tuple syntax

From a syntax viewpoint, you create a tuple by placing a sequence of items
inside a pair of enclosing parentheses and separating them by commas. Note that
the parentheses can be omitted when such omission will not lead to ambiguity.

Note that they point out you can leave out parens only when it won't lead to
ambiguity. C doesn't make that mistake. They make sure there is no ambiguity,
and if you leave out a parens it doesn't make the statement ambiguous, it makes
it
a different or erroneous statement altogether.
 
C

C# Learner

["Followup-To:" to to microsoft.public.dotnet.languages.csharp]

Martin said:
While your original flamebait

My intention was /not/ to start a flame war, but to start a healthy
discussion on the subject of C and why its basic syntax is present in so
many modern programming languages.

If I had asked that question simply and directly, I doubt that many
would've given it a second thought. This is unfortunate detail to keep
in mind when posting to USENET, or other such Internet forums. There
needs to be a little spice to get a discussion going. This is what was
provided by myself in my thread-starter.
wasn't particularly an example of decency
on your part, at least have the decency to stop posting off-topic *now*,
please.

Oh, now that Martin's joined the fray, we're no longer allowed to
continue a discussion which has a sub-thread which is /ever so slightly/
off-topic. Hmph.
If you really believe that the intention of Alex' reply was to start
an elaborate discussion about the Chinese language in comp.lang.c,

Please take the time to /read/ the messages you're replying to. My
reply only just touches on the subject of the Chinese language. My
intention was /not/ to start an elaborate discussion about the Chinese
language.
I recommend that you stay off Usenet until you have learned to pick up
hints.
http://www.winternet.com/~mikelr/flame12.html

Off-topic, therefore Followup-To: poster.

I have no intention to e-mail my reply directly to you, so I disregarded
that follow-up. From the tone of your reply, it seems that had I given
you my e-mail address, I'd be harassed!

I've set follow-ups to microsoft.public.dotnet.languages.csharp, since
people in there are cool. However, my experience has shown that the
people in comp.lang.c, on the other hand, are a bunch of snobby a*******s!

I've posted in that group before and I got flamed in reply almost every
time. I also lurk in that group and notice that even regulars get
/regularly/ flamed there, for little or no reason.

Yeah, yeah, call me a troll. Whatever. This is my opinion, and you
asked for it by /flaming/ me.

Anyway, as I said, I'm not going to e-mail you, and may well proceed to
plonk you due to your heavy-handedness and your apparent snobby attitude.

Goodbye.
 
L

Lew Pitcher

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

C# Learner wrote:
| Why is C syntax so uneasy on the eye?

I would disagree with that assertion; I do not find C syntax "uneasy on the eye".

| In its day, was it _really_ designed by snobby programmers to scare away
| potential "n00bs"?

"It's day" is hardly over, and the designers of C had other things on their
minds than attempting to scare away neophytes.

| If so, and after 50+ years of programming research,
| why are programming languages still being designed with C's syntax?

Perhaps because it works?

| These questions drive me insane. Every waking minute...

These are trivialities. Learn five or six computer languages (or three or four
that are entirely unrelated to each other), /then/ formulate your opinion.

Just remember, the computer doesn't care what language the program is written
in; it's all machine language to the CPU. Computer 'language' is for /human/
consumption, and is designed to meet the needs of the programmer and his/her
environment. Some languages are exceedingly suscinct (i.e. APL or RPG), and
some are very verbose (i.e. COBOL, SNOBOL, PL/I, Assembly (any processor)).
Some languages are procedural, some are OO, some are list processors, some are
macro languages. Learn a few, see what they do and where they are used.

Only then can you conduct a reasonable conversation on the topic.

- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAtTl+agVFX4UWr64RAntoAJ9pk9dL4gzdc9Vk56pcIDMtV7yj4gCfY7k0
sTaxl6obapbLPdS7z9Hy6HI=
=jJJD
-----END PGP SIGNATURE-----
 
C

C# Learner

Lew Pitcher wrote:

[...]
| In its day, was it _really_ designed by snobby programmers to scare away
| potential "n00bs"?

"It's day" is hardly over, and the designers of C had other things on their
minds than attempting to scare away neophytes.

By "its day" ("it's day" is grammatically incorrect, by the way), I
actually meant the days around which it was designed. I phrased it
incorrectly -- my mistake.

[...]
| These questions drive me insane. Every waking minute...

These are trivialities. Learn five or six computer languages (or three
or four
that are entirely unrelated to each other), /then/ formulate your opinion.

Well, I have learned BASIC, C-like languages (C and C++), Delphi
(formerly named 'Object Pascal') and Smalltalk.

So, basically, I've learned a couple of procedural languages, and a
couple of OO ones.
Just remember, the computer doesn't care what language the program is
written
in; it's all machine language to the CPU. Computer 'language' is for
/human/
consumption, and is designed to meet the needs of the programmer and
his/her
environment.

Exactly -- and this is why I see high-level language syntax to be so
important.

I feel that popular, modern-day high-level languages are tainted by a
specific syntax that has carried over through decades, one which I feel
is somewhat inhibitive. I feel it's inhibitive in the sense that code
written in it needs to conform to a syntax that could be nicer, and make
for easier-to-read source code.
Some languages are exceedingly suscinct (i.e. APL or RPG), and
some are very verbose (i.e. COBOL, SNOBOL, PL/I, Assembly (any processor)).
Some languages are procedural, some are OO, some are list processors,
some are
macro languages. Learn a few, see what they do and where they are used.

Only then can you conduct a reasonable conversation on the topic.

I don't understand why I'd need to learn a few more languages to
understand that C's basic syntax could be nicer.
 
K

Kieran Simkin

C# Learner said:
One of the biggest flaws in C syntax, in my opinion, is the required
parentheses for test conditions.

I think you confuse a flaw with part of the language specification.
Here's a very simple example:

void Foo
{
if (FooBar(Parse(Process(GetInput())))
DoSomething();
}

Imagine if, instead, we could write the following:

void Foo
{
if FooBar(Parse(Process(GetInput())):
DoSomething();
}

I'm imagining, and I'm reminded of BASIC.
Python uses such a construct for test conditions.

Another nicety about Python is the fact that whitespace is used for
defining code blocks. This makes code much clearer than the equivalent
C code, which requires block being/end markers.

Here's a very simple Python code sample:
http://www.kernelthread.com/hanoi/html/py.html .

Try staring at it for one minute.

Have just done so, this code (admittedly having never even looked at Python
before) seems completely unreadable to me. Maybe I'm just used to C syntax.
After having done so, take a look at this:
http://www.kernelthread.com/hanoi/html/c.html .

Even if one's accustomed to C syntax, the former is still clearer and
easier-to-read, don't you think?

No, not really. Python may be easier for you because that may be what you're
used to looking at, but C and PHP are what I do (PHP's syntax is more
similar to C's than Python's) and their syntax makes perfect sense to me. It
seems to me there may not be a "better" way; just different ways - although
it does seem to me that Python code would be prone to breaking when cnped
between things which do not preserve tab formatting for example (such as
some newsreaders).

One of the things I like about C is that whitespace most often doesn't
matter and I can control exactly how I want my program to look and read
rather than have it laid out for me by the language specification.
Every time I see code that conforms to C's basic syntax, I cringe; yet I
write such code every day.

Why C? Why?!

This is the kind of question which could easily attract a lot of annoyance.


Obviously this entire post is off-topic. Python is not C, C will never be
Python and you've cross-posted to C# which is not C either.
 
J

Jack Klein

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Sosman wrote:
| C# Learner wrote:
|
|> Why is C syntax so uneasy on the eye?
|>
|> In its day, was it _really_ designed by snobby programmers to scare
|> away potential "n00bs"? If so, and after 50+ years of programming
|> research, why are programming languages still being designed with C's
|> syntax?
|>
|> These questions drive me insane. Every waking minute...
|
|
| If you want COBOL, you know where to find it.
|

I resemble that remark! :)

FWIW, if you want a computer language that's really "uneasy on the eye", try
APL or RPG2. Even Lisp isn't very easy to read.

You haven't liven until you've seen badly written PL/M (note the 'M').

Their equivalent of C's switch...case still gives me nightmares after
all these years.
OTOH, I've had to read through pages of Java recently (analysis and design of
a new web component for my corporate masters, requiring review of our current
j2ee web apps), and if Java is the new "readability", then give me C any day.
Worse spaghetti code than you could find in any assembly program. I have no
doubt that C# and C++ are just as bad.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
 
C

C# Learner

Kieran said:
[...]
After having done so, take a look at this:
http://www.kernelthread.com/hanoi/html/c.html .

Even if one's accustomed to C syntax, the former is still clearer and
easier-to-read, don't you think?

No, not really. Python may be easier for you because that may be what you're
used to looking at,

Aha, but I only saw Python code for the /first/ time yesterday. :)
but C and PHP are what I do (PHP's syntax is more
similar to C's than Python's)
Cool.
[...]
Every time I see code that conforms to C's basic syntax, I cringe; yet I
write such code every day.

Why C? Why?!

This is the kind of question which could easily attract a lot of annoyance.

Okay, I accept that. I don't mean to annoy -- it's just my style of
writing. If I've annoyed then I apologize to all those affected.

Also, I guess I'm just trying to make a point and get heard here; and,
at the same time, I want to hear what those who are more experienced
than me have to say on the matter -- especially C gurus!

For the record, I don't /hate/ this C syntax of which I talk. I just
have a feeling of disbelief, perhaps, that some badly-implemented (in my
opinion) syntactial elements of the C language have passed through to
modern programming languages.
Obviously this entire post is off-topic. Python is not C, C will never be
Python and you've cross-posted to C# which is not C either.

Hmm... I have to disagree. I feel that this discussion is about C's
basic syntax and its ubiquity in popular modern-day languages.

If such a discussion is off-topic for comp.lang.c, then I honestly don't
know quite where it would be /on/-topic. In fact, I even considered
renaming the subject of this post to 'Re: C Syntax', but didn't want to
enrage people by doing so.

In any case, this was also posted to
microsoft.public.dotnet.languages.csharp since I wanted to hear some
opinions from those people too, and that is also the group which I read
more.
 
S

Stephen Sprunk

C# Learner said:
One of the biggest flaws in C syntax, in my opinion, is the required
parentheses for test conditions.

Without the parens you would need a "then" keyword of some kind. It seems
like an even trade.
Another nicety about Python is the fact that whitespace is used for
defining code blocks. This makes code much clearer than the equivalent
C code, which requires block being/end markers.

OTOH, C not using whitespace to mean anything gives programmers lots of
flexibility in how they format their source code to improve readability.

Block begin/end markers are very useful, and having such things explicit
arguably makes things easier for both the compiler and subsequent coders.
Here's a very simple Python code sample:
http://www.kernelthread.com/hanoi/html/py.html .

Try staring at it for one minute.

After having done so, take a look at this:
http://www.kernelthread.com/hanoi/html/c.html .

Even if one's accustomed to C syntax, the former is still clearer and
easier-to-read, don't you think?

That depends on the reader; the C version is far clearer to me. You also
put error-checking into the C version that's not in the Python one, which is
unfair when considering code length.

S
 
I

I. Appel

opinion.

Well, I have learned BASIC, C-like languages (C and C++), Delphi
(formerly named 'Object Pascal') and Smalltalk.

So, basically, I've learned a couple of procedural languages, and a
couple of OO ones.

And which one do seems you the best?
Which one seems to have the best syntax?

All your languages are Algol-derivative, so they share equivalent
syntactic constructs and all them are similar.

Try to learn something truly alternative. Try FORTRAN 77, the language
without any flame wars about indentation. Try LISP, the language with
syntax based on two symbols. Then come back.

When personally I met C, I already knew BASIC and Pascal and I was amused
by the expressiveness and brevity of C's syntax. I still think that
for (i=0;i<10;i++) {...}
is much better than
for i:=0 to 9 do begin ... end;
I don't understand why I'd need to learn a few more languages to
understand that C's basic syntax could be nicer.

Suggest some improvements and I'll say you, why you're wrong ;-)
 

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

Top