473,889 Members | 1,654 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 7144
"Malcolm" <ma*****@55bank .freeserve.co.u k> wrote:
"Old Wolf" <ol*****@inspir e.net.nz> wrote in message

Why do you say that? I thought the whole raison d'etre of VB
was so that people who grew up with BASIC would still be in the
familiar. Why else would anybody use such a horrible language?

Microsoft was built on BASIC interpreters, so I imagine they keep the
langauge going for sentimental reasons.


Micro$oft and sentiment... ya, right. They keep VB going because they
can sell large numbers of copies of VB to large numbers of
semi-professional suckers.

Richard
Nov 14 '05 #131
In <c9**********@n ews6.svr.pol.co .uk> "Malcolm" <ma*****@55bank .freeserve.co.u k> writes:

"Old Wolf" <ol*****@inspir e.net.nz> wrote in message

Why do you say that? I thought the whole raison d'etre of VB
was so that people who grew up with BASIC would still be in the
familiar. Why else would anybody use such a horrible language?

Microsoft was built on BASIC interpreters, so I imagine they keep the
langauge going for sentimental reasons.


More likely, because BASIC is easier to learn than most other programming
languages. It's also well interfaced with other Microsoft products, like
Excel.

If someone is interested in becoming an amateur programmer on Windows,
I can't imagine anything more suitable for the purpose than VB.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #132
In <ln************ @nuthaus.mib.or g> Keith Thompson <ks***@mib.or g> writes:
(As long as we have an '[OT]' tag on this thread ...)

I haven't played with Python enough to form a strong opinion about its
indentation-oriented syntax, but I think I like it. When I program in
a language that expressions nesting with delimiters (begin/end, {/},
case/esac), I maintain strictly consistent indentation anyway. I go
to the effort of indenting my code properly, and the compiler doesn't
even warn me if I get it wrong. Python lets me omit the delimiters;
the indentation is exactly what it would have been if Python required
delimiters as well.

C's use of delimiters to denote nesting allows some flexibility that
Python doesn't, but I see no virtue in that flexibility.


If the ASCII HT character (and its likes in other character sets,
represented as \t in C) hadn't been invented or had very solidly defined
semantics, I would have agreed with your analysis. Unfortunately, their
invention as loosely defined control characters opened Pandora's box...

The immediate reaction to this remark: "if you never use them, their
existence doesn't hurt you" is, unfortunately, too naive:

1. Even if you don't, someone else may. With different semantics than
your defaults. People dealing with other people's code are probably
well aware of the issue. But in C, the block delimiters provide all
the information needed for fixing the indentation broken by the HTs...

2. Even if you don't, some text processing utilities may do it behind your
back. A typical example is vi, which "optimises" the storage of the
saved text by replacing multiple spaces by HTs according to the ts
variable setting. Since I have found no portable way of disabling this
feature, I'm setting ts to 100 in my .exrc.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #133
> > >foo = lambda x, y: [str (i+j) for (i,j) in zip(x,y)]

Well, it's not very clear, but how many lines of code in C
would be required to reproduce it? Types of x and y can be
either lists of lists, lists of strings, lists of numbers
or strings. And it maybe used for all that stuff.

I don't understand, how several dozens lines of code can be
better than ONE line of code in non-esoteric language.


As you said, it's not very clear ;-) Actually, you'll have to define
"better" before you're qualified to offer an opinion.


What is the reason to have syntax that is clearer-per-line, if it
requires to write several times more lines of code?


The functional versional would be compact and neat, but almost certainly
slower to exectue; the imperative version would be bigger, uglier, but most
probably faster. No one can claim that one is better than another, as it
completely depends on what you are trying to achieve.

Mike
Nov 14 '05 #134

On Thu, 3 Jun 2004, Dan Pop wrote:
[re: hard tabs] A typical example is vi, which "optimises" the storage of the
saved text by replacing multiple spaces by HTs according to the ts
variable setting. Since I have found no portable way of disabling
this feature, I'm setting ts to 100 in my .exrc.


I'm sure you've thought of this, but what happens if you set ts to 0?
I would expect either that it would disable the "feature" altogether,
or that you'd get an error from vi. If the former, then this would be
a better way than setting ts to an arbitrary large value like 100.

-Arthur
Nov 14 '05 #135
In <Pi************ *************** *******@unix49. andrew.cmu.edu> "Arthur J. O'Dwyer" <aj*@nospam.and rew.cmu.edu> writes:

On Thu, 3 Jun 2004, Dan Pop wrote:
[re: hard tabs]
A typical example is vi, which "optimises" the storage of the
saved text by replacing multiple spaces by HTs according to the ts
variable setting. Since I have found no portable way of disabling
this feature, I'm setting ts to 100 in my .exrc.


I'm sure you've thought of this, but what happens if you set ts to 0?
I would expect either that it would disable the "feature" altogether,
or that you'd get an error from vi.


The latter. vi's response to "set ts=0":

Argument must be positive: ts=0
If the former, then this would be
a better way than setting ts to an arbitrary large value like 100.


Not even then. Keep in mind that I have to use vi on texts/programs
written by other people, too (like, e.g. when replying to Usenet posts).
With a ts=0, I would *silently* lose indentation information present in
those texts. With ts=100 I see it as humongously indented text, in which
case I simply reset ts to 8 and get something close to what the author
intended.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #136
> Well, I had to place more IMO's, but check this:

foo = lambda x, y: [str (i+j) for (i,j) in zip(x,y)]

Well, it's not very clear, but how many lines of code in C
would be required to reproduce it? Types of x and y can be
either lists of lists, lists of strings, lists of numbers
or strings. And it maybe used for all that stuff.

I don't understand, how several dozens lines of code can be
better than ONE line of code in non-esoteric language.

Now one question arises: What exactly does this piece of code do?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 14 '05 #137

"Dan Pop" <Da*****@cern.c h> wrote in message

More likely, because BASIC is easier to learn than most other
programming languages. It's also well interfaced with other
Microsoft products, like Excel.

If someone is interested in becoming an amateur programmer on
Windows,
I can't imagine anything more suitable for the purpose than VB.

I'm a BASIC implementer myself, so I wouldn't say anything against the
language. I'd say that the main strength of BASIC is that it is so easy to
write an interpreter - obviously that is now irrelevant to a company with
the resources of Microsoft. That's why it was included on all the 80s
vintage microcomputers, and why I learnt it as my first programming
language.
Nov 14 '05 #138
Da*****@cern.ch (Dan Pop) writes:
[...
2. Even if you don't, some text processing utilities may do it behind your
back. A typical example is vi, which "optimises" the storage of the
saved text by replacing multiple spaces by HTs according to the ts
variable setting. Since I have found no portable way of disabling this
feature, I'm setting ts to 100 in my .exrc.


I'm not quite willing to do that, but I do have the following in my
$HOME/.exrc:

map ]^V^I :%!expand^M

where the carets denote the obvious cotro characters.

As I enter code, vi (I use nvi) insists on changing each 8 columns of
indentation to a tab, but before saving the file I can hit a
right-bracket followed by a tab and expand everything to spaces
(unless I'm writing a Makefile, of course).

--
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 #139
Dan Pop wrote:
A typical example is vi, which "optimises" the storage of the saved
text by replacing multiple spaces by HTs according to the ts variable
setting. Since I have found no portable way of disabling this
feature, I'm setting ts to 100 in my .exrc.


Is there a reason why you can't use, say, VIM, which doesn't have this
problem and has an 'expandtab' option and :retab for your convenience?

--
++acr@,ka"
Nov 14 '05 #140

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

Similar topics

699
34429
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
3444
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
2322
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
2619
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
2548
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
2985
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
3792
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
7635
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
16266
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
11203
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...
0
10794
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10896
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
7151
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();...
0
5830
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6029
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4650
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
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3257
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.