473,799 Members | 3,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C Syntax

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...
Nov 14 '05
177 7100
Grumble wrote:
C# Learner wrote:
Simply:

1) Remove the need to specify parentheses for test conditions --
substitute a test condition terminator, such as Python's ':'.

#define if if (
#define then )

int main(int argc, char **argv)
{
if argc-1 == 0 then return 666;
return 0;
}


Point taken. :-)

Still, though, if others don't do this, then, when reading others' code,
the problem (as I see it) is still there.
Nov 14 '05 #51
I. Appel wrote:

[...]
I'd say Delphi has the clearest syntax.


Delphi is boring. IMO syntax of C is much more funny.


<my opinion>
Delphi code is, in general, much more readable than C code. Therefore,
Delphi coders have an easier life than C coders.
</my opinion>

[...]
Nov 14 '05 #52
On Thu, 27 May 2004 21:08:47 +0100, C# Learner <cs****@learner .here>
wrote:

My point is that a different construct could be substituted in each case.


Making the syntax more complex, for no particular benefit that I can
see.

Parentheses, brackets and braces represent the general concept of
grouping. Even when seen in an unfamiliar context, one can get the
idea. I see no need to invent a different grouping symbology for each
use.

Everyone understands the symmetry between '(' and ')'. The symmetry
between 'if' and ':' is not nearly as intuitive. And now you propose
that each case that requires a grouping operator have a different
construct?

Of course, you say "could be substituted", which is obviously true. It
would certainly add a new dimension to the obfuscated C contests.

--
Al Balmer
Balmer Consulting
re************* ***********@att .net
Nov 14 '05 #53

"C# Learner" <cs****@learner .here> wrote in message
news:Or******** ******@TK2MSFTN GP12.phx.gbl...
Grumble wrote:
C# Learner wrote:
Simply:

1) Remove the need to specify parentheses for test conditions --
substitute a test condition terminator, such as Python's ':'.

#define if if (
#define then )

int main(int argc, char **argv)
{
if argc-1 == 0 then return 666;
return 0;
}


Point taken. :-)

Still, though, if others don't do this, then, when reading others' code,
the problem (as I see it) is still there.


The 'problem' of not understanding a language's syntax,
is solved by learning it.

The 'problem' of disliking a language's syntax,
is solved by using a different language (whose syntax you
do like).

-Mike
Nov 14 '05 #54
On Thu, 27 May 2004 21:11:28 +0100, in comp.lang.c , C# Learner
<cs****@learner .here> wrote:
Mark McIntyre wrote:

Okay, I'll bite. Why on earth do you consider this in any way an
improvement? What difference does it make to anything?
I believe that it'd improve code readability.


I disagree. The delimiter helps mark the ends of the various parts of the
statement. With only whitespace to work with, compound statements become
almost impossible to correctly read.
Have you noticed how, in
langauges which use such syntax, .....they use spaces because of the fact that parentheses are used both
in test conditions and function calls. As far as I see, when doing so,
they're just attempting to work around a syntactical design flaw of the
language.


Gonads. This is nothing more than a style thing. French people put two
spaces after a full stop. English people don't. Same idea.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.c om/ms3/bchambless0/welcome_to_clc. html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #55
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...


This is an obvious troll. Please Ignore it.
Nov 14 '05 #56
Grumble <a@b.c> writes:
C# Learner wrote:
Simply:
1) Remove the need to specify parentheses for test conditions --
substitute a test condition terminator, such as Python's ':'.


#define if if (
#define then )

int main(int argc, char **argv)
{
if argc-1 == 0 then return 666;
return 0;
}


Yes, that's very clever. Please don't do it in any code that I might
ever have to maintain, or read -- or that anyone else might ever have
to maintain or read.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #57
qe*@pobox.com (Paul Hsieh) writes:
[...]
C has plenty of ambiguity:

- Braces are optional if there is only one statement for if() or for() or
while(). (But not for do ... while(), switch, or structure/union
declarations.)


That's not an ambiguity, it just means there's more than one way to
write a given program. The fact that braces are optional in many
contexts does not imply that there is any C program that can be
interpreted in any of two or more ways; the interpretation is
unambiguous in each case.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #58
C# Learner <cs****@learner .here> writes:
Kieran Simkin wrote:

[...]
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.


Discussion of how other languages have influenced C would be topical
in comp.lang.c. Discussion of how C has influenced a hypothetical
language Foo would be topical (I presume) in comp.lang.foo. But if
you want to discuss how C has influenced other languages in general,
that's probably a good topic for comp.lang.misc.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #59
Da*****@cern.ch (Dan Pop) wrote:

None of the programming languages assigning semantics to indentation
has ever become mainstream. There must be a reason...


The language of makefiles?
(Before you say "it isn't a language", it seems to be as much
a language as Prolog is)
Nov 14 '05 #60

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
34267
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
22
3433
by: Tuang | last post by:
I'm checking out Python as a candidate for replacing Perl as my "Swiss Army knife" tool. The longer I can remember the syntax for performing a task, the more likely I am to use it on the spot if the need arises. If I have to go off and look it up, as I increasingly have to do with Perl's ever hairier syntax, I'm more likely to just skip it, making me even less likely to remember the syntax the next time. So I hear that Python is easier...
14
2318
by: Sandy Norton | last post by:
If we are going to be stuck with @decorators for 2.4, then how about using blocks and indentation to elminate repetition and increase readability: Example 1 --------- class Klass: def __init__(self, name):
16
2611
by: George Sakkis | last post by:
I'm sure there must have been a past thread about this topic but I don't know how to find it: How about extending the "for <X> in" syntax so that X can include default arguments ? This would be very useful for list/generator comprehensions, for example being able to write something like: instead of the less elegant explicit loop version that has to check for the length of each sequence. What do you think ? George
23
2540
by: Carter Smith | last post by:
http://www.icarusindie.com/Literature/ebooks/ Rather than advocating wasting money on expensive books for beginners, here's my collection of ebooks that have been made freely available on-line by their authors. There are lots of them out there but this selection cuts out the junk. If you know of any other good books that are freely available please post a link to them here and I'll consider adding them to the site.
19
2980
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $ Last-Modified: $Date: 2003/09/22 04:51:49 $ Author: Nicolas Fleury <nidoizo at gmail.com> Status: Draft Type: Standards Track
4
3785
by: Jeremy Yallop | last post by:
Looking over some code I came across a line like this if isalnum((unsigned char)c) { which was accepted by the compiler without complaint. Should the compiler have issued a diagnostic in this case? (I think it's not required to, but I'd like confirmation). Jeremy.
4
7627
by: Bob hotmail.com> | last post by:
Everyone I have been spending weeks looking on the web for a good tutorial on how to use regular expressions and other methods to satisfy my craving for learning how to do FAST c-style syntax highlighting in C# but I have yet to find anything useful I know there are people at MS that know this stuff like the front of their hand and I know there are many people out on the web that are proficient in doing this as well but it seems nobody...
3
16253
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very strange error. In your experience, where I should looking to find the real error? Surely the sintax of glut is correct... gcc.exe -c glut_bitmap.c -o glut_bitmap.o -I"C:/Dev-Cpp/include" -I"../../include" -D__GNUWIN32__ -W -DWIN32 -DNDEBUG...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10214
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9067
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7561
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.