Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > If you could change the C or C++ or Java syntax, what would you like different?

Reply
Thread Tools

If you could change the C or C++ or Java syntax, what would you like different?

 
 
Ben Bacarisse
Guest
Posts: n/a
 
      10-14-2010
"Jon" <(E-Mail Removed)> writes:

> James Dow Allen wrote:
>> On Oct 9, 2:09 am, Alexander <(E-Mail Removed)> wrote:
>>> ... anything you do not like in the C ... syntax.

>>
>> I'll offer 2 cents worth:

<snip>
>> (2) Some will mention the second-class nature of arrays
>> as being bad.

>
> Explain please "second class nature of arrays".


The term has a standard meaning in this sort of context:
http://en.wikipedia.org/wiki/First-class_object

<snip>
--
Ben.
 
Reply With Quote
 
 
 
 
Ben Bacarisse
Guest
Posts: n/a
 
      10-14-2010
"Jon" <(E-Mail Removed)> writes:

> August Karlstrom wrote:

<snip>
>> It's a shame that a left arrow is not in the (7 bit) ASCII table. IMHO
>> `:=' is second best to the left arrow.
>>

>
> The litmus test (C syntax):
>
> a = sqrt(b^2 + c^2)
>
> Anyone suggesting anything is more obvious (about the equal symbol) than
> the above is a dufus. a "equals what I tell you it equals", *I* am the
> programmer. The STATEMENT (not a ponderance), says, evaluate that
> expression and put the result where *I* wanted. (What all you
> mathematicians are up about, I will consider).


Given the "dufus" remark, it's possible that you are not bothered about
having a debate, but assignment it very different from "making this
equal that". If the type of 'a' is int, for example, a = E; may leave
a != E in many cases.

This is, in part, an argument that quality and assignment should use
different symbols (and C complies with this) but because assignment is
asymmetric, it's a shame that the symbol isn't similarly asymmetric.
Both := and an arrow have that in their favour. It's also an argument
that assignment should not be so similar to equality that people forget
the difference, but this is almost a psychological point rather than a
programming one.

A couple of minor points: what you wrote is an expression not a
statement. It would be a statement if it had a trailing semi-colon.
Secondly, I presume that the xor b^2 is written in jest, yes? [For
anyone new to C reading this, C does not have an exponentiation
operator.]

--
Ben.
 
Reply With Quote
 
 
 
 
Felix Palmen
Guest
Posts: n/a
 
      10-14-2010
* BartC <(E-Mail Removed)>:
> In other contexts, a pointer/array attribute is part of the type, eg. in
> casts (and the dereference symbol appears on the right).


Alright, I really forgot about casts. I tend to write tham like this:

T *foo = (T *)bar;

But of course, this is just some cosmetic. If one would remove these
attributes from the type in casting, the possibility to cast between
pointers and values would disappear. Is it really needed?

Regards,
Felix

--
Felix Palmen (Zirias) + [PGP] Felix Palmen <(E-Mail Removed)>
web: http://palmen-it.de/ | http://palmen-it.de/pub.txt
my open source projects: | Fingerprint: ED9B 62D0 BE39 32F9 2488
http://palmen-it.de/?pg=pro + 5D0C 8177 9D80 5ECF F683
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-14-2010
"Jon" <(E-Mail Removed)> writes:
> Nick Keighley wrote:
>> use typedef (which should be called typealias)

>
> #define Alias typedef
>
> If the preprocessor is not your friend, then C will be your enemy. You're
> welcome.


If I'm reading code that uses typedef, I have to understand how typedef
works.

If I'm reading code that uses your "Alias" macro, I still have to
understand how typedef works -- *and* that "Alias" means typedef.

It doesn't help.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      10-14-2010
On Thu, 14 Oct 2010, Seebs wrote:

> On 2010-10-14, RedGrittyBrick <(E-Mail Removed)> wrote:
>> Oh OK. I thought penne were the "pen shaped" short diagonally-cut tubes.

>
> Yes. A similar argument explains manicotti.


I have no opinions or knowledge to share on this, but i am genuinely
really hungry now.

tom

--
I believe there is no philosophical high-road in science, with
epistemological signposts. No, we are in a jungle and find our way by
trial and error, building our road behind us as we proceed. -- Max Born
 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      10-14-2010
"Seebs" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 2010-10-14, RedGrittyBrick <(E-Mail Removed)> wrote:
>> Oh OK. I thought penne were the "pen shaped" short diagonally-cut tubes.

>
> Yes. A similar argument explains manicotti.


The one that amuses me is "ziti". http://recipes.wikia.com/wiki/Ziti

It comes from a word meaning "bridegroom". One pasta book I had claimed not
to know why that was. I couldn't tell if the author was truly ignorant, or
couldn't, as they say, find a suitably delicate way of expressing the
relationship. A web search informs me that the original ziti were much
larger.




Brian
--
Day 617 of the "no grouchy usenet posts" project.


 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      10-14-2010
BartC wrote:

>> That statement leads to believe that you delved into a "sizeable C
>> project" without even knowing how
>> to program in C,

>
> I don't know how you deduced that from my statement.


This is not up to debate: if you fail to understand how to assign values to variables in a
programming language then you simply don't know how to use it. You simply can't hack away Pascal
code in a text file with a .c extension and not only expect it to be C but also complain that the
compiler throws syntax errors.


Rui Maciel
 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      10-14-2010
Jon wrote:

> That solution has been tried many times and has been found to be
> inadequate as many times as it has been tried. It can't be fixed at the
> library level because it's a language level problem.


Nonsense.


Rui Maciel
 
Reply With Quote
 
BartC
Guest
Posts: n/a
 
      10-15-2010


"Rui Maciel" <(E-Mail Removed)> wrote in message
news:4cb79208$0$6656$(E-Mail Removed)...
> BartC wrote:
>
>>> That statement leads to believe that you delved into a "sizeable C
>>> project" without even knowing how
>>> to program in C,

>>
>> I don't know how you deduced that from my statement.

>
> This is not up to debate: if you fail to understand how to assign values
> to variables in a
> programming language then you simply don't know how to use it.


Yes, when I sometimes fumble for the gear stick in a left-hand-drive car,
after normally using right-hand-drive, it means I don't know how to drive.

The project happened to be mixed language. Also, the problem wasn't so much
using ":=" in C, which is quickly picked up as a syntax error, as using "="
in the other language, which was still legal but did bad things that were
hard to track down.

Since I'd used the other language for many years (having invented it), I
don't think the problem was not knowing how to use it. Just getting muddled
(because the designers of C inconsiderately used the wrong assignment
symbol...)


--
Bartc


 
Reply With Quote
 
Nick
Guest
Posts: n/a
 
      10-15-2010
"BartC" <(E-Mail Removed)> writes:

> The project happened to be mixed language. Also, the problem wasn't so
> much using ":=" in C, which is quickly picked up as a syntax error, as
> using "=" in the other language, which was still legal but did bad
> things that were hard to track down.
>
> Since I'd used the other language for many years (having invented it),
> I don't think the problem was not knowing how to use it. Just getting
> muddled (because the designers of C inconsiderately used the wrong
> assignment symbol...)


I'm programming in a mixed environment of C, Javascript, a HTML
templating language with loop constructs and a home-brew scripting
language. Not to mention little bits of embedded SQL, make files and
similar.

It's not that uncommon to get an error because I've put a semicolon on
the end of a line in the scripting language, or used == in it.
--
Online waterways route planner | http://canalplan.eu
Plan trips, see photos, check facilities | http://canalplan.org.uk
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If you could change the C or C++ or Java syntax, what would you like different? Alexander C++ 68 11-08-2013 01:23 PM
don't like, so don't waste your time thinking and buy them. You know,if you don't like one thing, it means nothing for you.</p> fashion t shirts seller Cisco 0 06-13-2011 02:01 AM
If you could change the C or C++ or Java syntax, what would you like different? Alexander Java 60 11-04-2010 05:36 AM
Incredible - I bet you would like a camera like this! ~BD~ Computer Security 1 02-26-2009 09:45 PM
Would you like to host a website about Java programming? Jaga Java 0 12-02-2003 06:12 PM



Advertisments