G
gwowen
Le 30/04/12 20:25, (e-mail address removed) a écrit :
C is perfect?
Wow. That's quite the non-sequitur.
Le 30/04/12 20:25, (e-mail address removed) a écrit :
C is perfect?
It doesn't really matter what you call a 3d point. Even a novice programmer, provided he was sane, could come up with a perfectly good typedef or convention, which could be used worldwide with no harm.On 04/30/2012 11:22 AM, Malcolm McLean wrote:
...
No one has that "weight". If it needs to be forced on people - if it
can't gain acceptance except by reason of being mandated by a
sufficiently powerful authority - it can't be good enough to justify
mandating it.
In addition to my other post concerning C++'s auto,
there are a number
of other additions to C++11 that would benefit in C without breaking
existing code, some examples
Scoped and strongly typed enums[1], embedded compilers often enable the
type of an enum to be selected, so may as well standardise.
yes!
Constant expressions[2] would extend the usefulness of const.
Alignment[3] another extension that may well be of more use in C (giving
its dominance in drivers and embedded).
Am 05/01/2012 07:43 AM, schrieb Ian Collins:
a nice feature, but reusing an existing keyword is a no-go, it is
simple as this
Constant expressions[2] would extend the usefulness of const.
there would be a less intrusive modification to C that could achieve
similar goal: register const declarations. Just
- make it constraint violations not to initialize them
- allow them at places where compile time constant expressions are
allowed
- allow them in global scope
Alignment[3] another extension that may well be of more use in C (giving
its dominance in drivers and embedded).
this one already made it into C11
See the last couple of paragraphs of this section:
http://www2.research.att.com/~bs/C++0xFAQ.html#auto
Constant expressions[2] would extend the usefulness of const.
there would be a less intrusive modification to C that could achieve
similar goal: register const declarations. Just
- make it constraint violations not to initialize them
- allow them at places where compile time constant expressions are
allowed
- allow them in global scope
That's pretty much the "old" C++ usage of const,
still a big improvement
over C.
Am 05/01/2012 10:21 AM, schrieb Ian Collins:
yes, I know all of that
first, I think that this will not easily convince the C committee
second, this is all useless complication, why the hell they didn't
invent another keyword, something like C usually does "_Auto" if it
must or even more descriptive "_Autotype"?
third, I am probably a rare animal, but I occasionally use that in
macros for which I want to be sure that they end up in function scope
Constant expressions[2] would extend the usefulness of const.
there would be a less intrusive modification to C that could achieve
similar goal: register const declarations. Just
- make it constraint violations not to initialize them
- allow them at places where compile time constant expressions are
allowed
- allow them in global scope
That's pretty much the "old" C++ usage of const,
not quite, such an "rvalue" wouldn't have an address
I am also not sure if it would be the same for composite types. C++'s
rules for initializing global const qualified variables always scared
me. Wasn't it that you only could initialize integer constants at the
point of declaration, and other types (even floating point) hat to be
initialized/constructed at the point of definition/instantiation.
Ben said:No language is perfect and so anyone assigning the tasks of
fixing "all [C's] problems and shortcomings" is setting an
impossible goal.
Ben said:Jacob, I'm criticizing the hypothetical assignment given by Rui,
not anything you wrote.
Keith said:But not persuasively, IMHO.
C is at a lower semantic level than a lot of other languages.
But the major difference between C and assembly language is that
an assembly program specifies CPU instructions, while a C program
specifies run-time behavior.
That's a huge distinction, with assembly languages on one side,
and C, C++, Ada, Python, APL, and Intercal firmly on the other.
That the person assigning the task get their head examined.
BGB said:this is more of an OS or tools issue than a language issue though.
Rui Maciel said:Another issue we might consider is that if we were given the task of
designing an assembly language which should be able to generate code for
multiple architectures, I suspect we would end up with a language which, in
terms of features, wouldn't be much different than C's core language.
Leo said:
Kaz Kylheku said:The problem with any major changes to C's type declaration syntax is that
they break "declaration follows use".
A declarator like (*p[3])(double) gives us a p which can actually be used
by
means of the syntax (*p[0])(3.0).
If you change how it is declared, but don't make a parallel change to the
expression syntax then you still have (*p[0])(3.0) /and/ the new syntax
which
is inconsistent with this.
Ian Collins said:On 05/ 1/12 11:24 AM, BartC wrote:
More often than not there's something wrong with the programmer who
conjurers up such a convoluted declaration! Seriously, 99.9% of the time
complex type declarations are unnecessary.
One simplification that would help not break (much!) code would be to
adopt C++'s reuse of "auto".
Rui said:If you were given the task to design a replacement for the C programming
language intended to fix all its problems and shortcomings, what would you
propopose?
Keith said:And it wouldn't be an assembly language.
If we're trying to come up with something better than #include, I'd
rather create a new mechanism that isn't part of the preprocess, and
doesn't look like it is (#pragma).
For example, this:
#include <stdio.h>
could be replaced by:
import stdio;
This would make all the declarations in the stdio "module" visible; it
would be up to the implementation to determine how to do that. There's
no implication that "import" performs a textual replacement.
Am 05/01/2012 07:43 AM, schrieb Ian Collins:
a nice feature, but reusing an existing keyword is a no-go, it is
simple as this
I've never come across that use auto before. Care to enlighten me?
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.