A metric ton is 1000Kg. Just as there is a metric pound - which is 500g. So Pulp Fiction was wrong - we do know what a quartepounder is - but it would have to be 125g of meat in europe and not 113,5g as in the US.
So the real reason why there is no quaterpounder in europe is: It saves McD 11.5g of meat.
Why not develop and build the prototype here in the Germany?
We need a Home Grown "Killer Application" / National Project to jumpstart the German economy and help eliminate our dependence on foreign oil. The loss of jobs resulting from manufacturing and High Tech operations moving off-shore, and the outsourcing of both technical and non-technical services in recent years is killing the German economy. We need to get back on track and reverse this loss.
Did not supprise me. I know lots of people who just increment the two numerics.
It was always my belive that if you make a password scheme to strict it becomes insecure because people cannot or don't want to remember a compilcated new password every x days.
As the old saying for screws goes: after very tight comes very looses. {For those not firm with mechanics: if you tighten an screw too much it will break}
How very true. In the end it stopped me from using GNOME. Is't no fun working with a system that stops working with the next upgrade because there where some unresolved dependecies. i.E.:
Gtk-WARNING **: Unable to locate loadable module in module_path: "libthinice.so",
KDE is based on C++ and not C while GNOME is based on C and not C#. Shows how little you know, realy.
And of corse - since it is KDE which uses the new technologies while GNOME is based on old technologies "Flavour OLD*-alike" is of wrong as well. Should be "Flavour NEW-alike" realy.
Maybe that KDE is older the GNOME - but GNOME was a huge step backwards and still is.
let me quote from another article I wrote a few minutes ago:
-- snip Besides: OpenSource and pay-software don't exclude each other. Take a look at http://www.adacore.com/. Ada-Core charges $15.000 for a 5 seat one year support contract for there Ada compiler but at the same time at there sister webseide (http://libre.act-europe.fr/) you can download the very same compiler for free. With full source code.
You wonder why anybody pays > $15.000 for something you can get for free? Well look at the customer list for enlighenment:
http://www.adacore.com/customers.php --snap
As allways it is the golden middle way. The Problem is: Microsoft does not want to go there.
But most new ideas come from the OpenSource comunity and not from pay-software writers. pay-software writers have there ideas limited by the "needs to make money" and company policy constraints while open source developers can express new ides just for the sake of expressing new ideas.
Besides: OpenSource and pay-software don't exclude each other. Take a look at http://www.adacore.com/. Ada-Core charges $15.000 for a 5 seat one year support contract for there Ada compiler but at the same time at there sister webseide (http://libre.act-europe.fr/) you donwload the very same compiler for free. With full source code.
You wonder why anybody pays > $15.000 for something you can get for free? Well look at the customer list for enlighenment:
Since you have done some Ada I can remind you of one important thing:
For every type T there is T'Base. The 'Base type is the type used by a given CPU you where talking about. The type of X_Range'Base was of course Standard.Natural. Standard.Natural'Base is Standart'Integer and that was 32 bit with the give compiler.
If you say:
A : X_Range:= 12;
Then the the Standart'Integer 12 is converted into X_Range. That will fail. And since it allways fails the compiler will warn you. If you prefer to get a compile time error you could have written:
A : X_Range:= X_Range'(12);
Remember: X_Range'(12) means Interpret the literal 12 as X_Range. 12 is not a valid X_Range - the program will not compiler. But since this will only work with literals it is beside the point. But it will alow me to show you an example where there is no bound check at all:
A : X_Range:= X_Range'(10); B : X_Range:= A;
In assignment of A line 10 is interpreted as an X_Range. The compiler will check at compile time that it is valid. Now A is a 32 bit number with a guarantee to be in the range of 1 to 10. When assigning to B the compiler will accept the guarantee and not check A again.
This is, of course not interesting. The following is:
procedure F (A : in X_Range) is
B : X_Range:= A; begin end F;
A is still guaranteed to be between 1 and 10. No additional check needed when assigning B. And coming back to an Array:
procedure Z (
A : in X_Range;
B : in X_Range;
X : in out X_String) is begin
for I in X_Range range A.. B loop
X (I):= Z; end Z;
No bound check needed here. A and B is guarantee to be in range 1..10. X is guaranteed to have an array element for each position in the range if 1.. 10. Each possible value of I is guaranteed to be a propper subscript for the array X. No types converted (A, B and I are 32 bit) no bounds checked (all bounds are guaranteed).
When I first read about Eiffel I was wondering why the contracts are checked outside the function and not inside. At first I considered it an enormous waste.
But then I began tho see that the contract can cascade upwards and only need to checked at the top level of the program.
Of corse there at the top level all bounds do indeed need to be checked. And when you choose your types unwise. i.E: just use the standart types:
procedure Z (
A : in Integer;
B : in Integer;
X : in out String) is begin
for I in Natural range A.. B loop
X (I):= Z; end Z;
will have tons of checks. X is an indefinite and carries two hidden extra parameters X'First and X'Last to make bound checks possible. A and B can be negative but all indices of X must be positive. etc. pp.
It all depends on how wise you choose your contracts if the cascading effect will happen or not.
procedure Test is
A : Integer:= 5;
B : Integer:= 2 * A + 1;
X : String (1.. 10); begin
X (B):= 'Z'; end Test;
and when you compile that with the gnu compiler collection:
>gcc -x ada -gnatwa -c test.adb test.adb:3:04: warning: "A" is not modified, could be declared constant test.adb:4:04: warning: "B" is not modified, could be declared constant test.adb:7:07: warning: value not in range of subtype of "Standard.Integer" defined at line 5 test.adb:7:07: warning: "Constraint_Error" will be raised at run time
And you are wrong when you think there is no type convertion in your example. You see in a strictly types language
X : String (1.. 10); is a shorthand for:
subtype X_Range is Natural range 1.. 10; subtype X_String is String (X_Range);
X : X_String;
Now B, beeing an Integer, is converted into the type of X'Range. I can make this clear by exanding the code:
procedure Test is
subtype X_Range is Natural range 1.. 10;
subtype X_String is String (X_Range);
A : constant Integer:= 5;
B : constant Integer:= 2 * A + 1;
X : X_String; begin
X (B):= 'Z'; end Test;
if you compile that:
>gcc -x ada -gnatwa -c test.adb test.adb:10:07: warning: value not in range of type "X_Range" defined at line 3 test.adb:10:07: warning: "Constraint_Error" will be raised at run time
Integer and the range of the X are different types and need to be converted. Most C programmers just don't know how often type are convertet. Try http://www.splint.org and see how often a type is converted in your programs. Of course, strictly typed languages help the programmer avoid type convertions. for excample in a loop:
for I in X'Range loop
No bound checks needed in that loop. I will iterate over every element of X - no more no less.
The usual Ada programmer spends only 1/10 of the time debugging when compared to a C programmer. He does spend a lot more time typing and analysing compiler output - But that is less painfull then debugging.
With Regards
Martin
Sorry for the bad formating:/. forced me to make paragraphs longer then I wanted to
The only time a bound need to be checked is when a type is converted. As long as you are within one type no checks are needed since the bound are already garaneed.
With there are some many type convertions that indeed checks would be needed left right and center.
say for example:
auto char X[10] = "123456789"; auto char Y[20] = "1234567890123456789";
x = y;
C's problem is that the arrays y and y are convertet to char* and then assigned. Hence the bounds are lost.
Calling strcpy would make things even worse!
In Ada, Modula-2 and Pascal the arrays are not converted and the compiler will be able to check the bound at compiler time and will isue an error - since X is not large enough to hold the value.
Other example:
typedef char T[10];
f (T X, T Y)
{
strcpy (x, y);
}
Again C converts the arrays into char* and looses the bounds. You can pass to many chars into the function and compiler says nothing:
f ("1234567890123", "123456789012345");
Again in Ada this would not happen. And again no bound check would happen. The compiler knows from the used type that both strings are 10 characters and can be assiged savely.
This is called "design by contract". And with "design by contract" the compiler will be able to optimize away most bound checks. Or even do them at runtime.
There is actualy a language call "SPARC" which will evaluate all contracts at compile time ensuring that no contract will be broken at runtime.
Programming SPARC is hard - but if you do the fly by wire of an Boing 777 any broken contract will meen 600 people drown in the atlantic ocean.
The problem with C is that you can write a contract down:
The Problem with C is that the default is unsave and you have to go out of your way to make it save.
There are programming where it is the other way round. Ada for example is often described as the "save language" yet it does have all the "unsave" features as well.
Unchecked_Convertion will convert everything as long as the size is the same.
"for X'Address use Y'Address" will convert even when the size does not fit. And it is faster - no data copied.
Yes you have to type more - but even when most of you never did any Ada you will all know what "for X'Address use Y'Address" means and that it is indeed a nasty hack.
But I give it to the C comunity: Sometimes you need nasty hacks. But do nasty hacks need to be the standart behavior of the language?
Well next year there is a Language revision - with containers.
Besides, before you claim there are no Container Libs for Ada you might at least try the simplest Google:
http://directory.google.com/Top/Computers/Programm ing/Languages/Ada/Bindings_and_Libraries/
Ada actualy has container libaries which can store polymorfic objects - something neither C++ nor Java can. They can only store pointers to polymorfic abjects.
Martin
The law in Germany is clear: If you take on a Message for someone else you must deliver. Payment is not required.
One alternative is not to take the message in the first place. That is you have to filter right inside the smtp Server and reject the message with an error code.
Other alternative is to use IMAP and filter the mail into different folder.
Yes D is interesting. Only, like Eiffel, it concentrates only on procedural contracts and lacks type contract.
SPARC, being based on Ada does have type contracts:
type Day_Of_Month is range 1..31;
BTW: The example won't work. It does not take into account the fact that math.sqrt(x) only calculates an approximation - which is truncated to long. Correct examples have been posted before - by SPARC hackers.
It is not a good sign that the D developers made such an obvious mistake.
It's an Ada example but still holds true in any language:
n tr ol#Isn.27t_goto_evil.3F
http://en.wikibooks.org/wiki/Programming:Ada:Co
Martin
You missunderstood: Not the MS prices are to to be lowered - the prices of the competition are.
Look at StarOffice: now only 79 - when I bought my first StarOffice it was more then 150.
Price for (non MS) Office products fell!
A metric ton is 1000Kg. Just as there is a metric pound - which is 500g. So Pulp Fiction was wrong - we do know what a quartepounder is - but it would have to be 125g of meat in europe and not 113,5g as in the US.
So the real reason why there is no quaterpounder in europe is: It saves McD 11.5g of meat.
Why not develop and build the prototype here in the Germany?
We need a Home Grown "Killer Application" / National Project to jumpstart the German economy and help eliminate our dependence on foreign oil. The loss of jobs resulting from manufacturing and High Tech operations moving off-shore, and the outsourcing of both technical and non-technical services in recent years is killing the German economy. We need to get back on track and reverse this loss.
Because everybody will write the password down as soon as nobody looks.
Did not supprise me. I know lots of people who just increment the two numerics.
It was always my belive that if you make a password scheme to strict it becomes insecure because people cannot or don't want to remember a compilcated new password every x days.
As the old saying for screws goes: after very tight comes very looses. {For those not firm with mechanics: if you tighten an screw too much it will break}
How very true. In the end it stopped me from using GNOME. Is't no fun working with a system that stops working with the next upgrade because there where some unresolved dependecies. i.E.:
Gtk-WARNING **: Unable to locate loadable module in module_path: "libthinice.so",
With Regards
Martin
Well,
KDE is based on C++ and not C while GNOME is based on C and not C#. Shows how little you know, realy.
And of corse - since it is KDE which uses the new technologies while GNOME is based on old technologies "Flavour OLD*-alike" is of wrong as well. Should be "Flavour NEW-alike" realy.
Maybe that KDE is older the GNOME - but GNOME was a huge step backwards and still is.
With Regards
Martin
Just out of curiosity: Which language where you actualy planning for?
Hello,
let me quote from another article I wrote a few minutes ago:
-- snip
Besides: OpenSource and pay-software don't exclude each other. Take a look at http://www.adacore.com/. Ada-Core charges $15.000 for a 5 seat one year support contract for there Ada compiler but at the same time at there sister webseide (http://libre.act-europe.fr/) you can download the very same compiler for free. With full source code.
You wonder why anybody pays > $15.000 for something you can get for free? Well look at the customer list for enlighenment:
http://www.adacore.com/customers.php
--snap
As allways it is the golden middle way. The Problem is: Microsoft does not want to go there.
With Regards
Hello,
But most new ideas come from the OpenSource comunity and not from pay-software writers. pay-software writers have there ideas limited by the "needs to make money" and company policy constraints while open source developers can express new ides just for the sake of expressing new ideas.
Besides: OpenSource and pay-software don't exclude each other. Take a look at http://www.adacore.com/. Ada-Core charges $15.000 for a 5 seat one year support contract for there Ada compiler but at the same time at there sister webseide (http://libre.act-europe.fr/) you donwload the very same compiler for free. With full source code.
You wonder why anybody pays > $15.000 for something you can get for free? Well look at the customer list for enlighenment:
http://www.adacore.com/customers.php
With Regards
Martin
Actualy the Asimov Laws are quite tricky as well. There are quite a few deadlock situation to look into as well.
Just to name the easiest one: Two Humans in iminent danger but only time to rescue one.
Or: Human in danger of death but his arm is stuck in a way that only cutting the arm off is a possible solution in the given timeframe for rescue.
But at least they are implementable with with definable rules. Like "cut arm off is smaller harm then death". Or "rescue owner first".
Since you have done some Ada I can remind you of one important thing:
:= 12;
:= X_Range'(12);
:= X_Range'(10); := A;
:= A;
.. B loop := Z;
.. 10. Each possible value of I is guaranteed to be a propper subscript for the array
.. B loop := Z;
For every type T there is T'Base. The 'Base type is the type used by a given CPU you where talking about. The type of X_Range'Base was of course Standard.Natural. Standard.Natural'Base is Standart'Integer and that was 32 bit with the give compiler.
If you say:
A : X_Range
Then the the Standart'Integer 12 is converted into X_Range. That will fail. And since it allways fails the compiler will warn you. If you prefer to get a compile time error you could have written:
A : X_Range
Remember: X_Range'(12) means Interpret the literal 12 as X_Range. 12 is not a valid X_Range - the program will not compiler. But since this will only work with literals it is beside the point. But it will alow me to show you an example where there is no bound check at all:
A : X_Range
B : X_Range
In assignment of A line 10 is interpreted as an X_Range. The compiler will check at compile time that it is valid. Now A is a 32 bit number with a guarantee to be in the range of 1 to 10. When assigning to B the compiler will accept the guarantee and not check A again.
This is, of course not interesting. The following is:
procedure F (A : in X_Range)
is
B : X_Range
begin
end F;
A is still guaranteed to be between 1 and 10. No additional check needed when assigning B. And coming back to an Array:
procedure Z (
A : in X_Range;
B : in X_Range;
X : in out X_String)
is
begin
for I in X_Range range A
X (I)
end Z;
No bound check needed here. A and B is guarantee to be in range 1..10. X is guaranteed to have an array element for each position in the range if 1
X. No types converted (A, B and I are 32 bit) no bounds checked (all bounds are guaranteed).
When I first read about Eiffel I was wondering why the contracts are checked outside the function and not inside. At first I considered it an enormous waste.
But then I began tho see that the contract can cascade upwards and only need to checked at the top level of the program.
Of corse there at the top level all bounds do indeed need to be checked. And when you choose your types unwise. i.E: just use the standart types:
procedure Z (
A : in Integer;
B : in Integer;
X : in out String)
is
begin
for I in Natural range A
X (I)
end Z;
will have tons of checks. X is an indefinite and carries two hidden extra parameters X'First and X'Last to make bound checks possible. A and B can be negative but all indices of X must be positive. etc. pp.
It all depends on how wise you choose your contracts if the cascading effect will happen or not.
With Regards
Martin
You example will be the following in Ada:
:= 5; := 2 * A + 1; .. 10); := 'Z';
.. 10);
.. 10;
.. 10;
:= 5; := 2 * A + 1; := 'Z';
/. forced me to make paragraphs longer then I wanted to
procedure Test
is
A : Integer
B : Integer
X : String (1
begin
X (B)
end Test;
and when you compile that with the gnu compiler collection:
>gcc -x ada -gnatwa -c test.adb
test.adb:3:04: warning: "A" is not modified, could be declared constant
test.adb:4:04: warning: "B" is not modified, could be declared constant
test.adb:7:07: warning: value not in range of subtype of "Standard.Integer" defined at line 5
test.adb:7:07: warning: "Constraint_Error" will be raised at run time
And you are wrong when you think there is no type convertion in your example. You see in a strictly types language
X : String (1
is a shorthand for:
subtype X_Range is Natural range 1
subtype X_String is String (X_Range);
X : X_String;
Now B, beeing an Integer, is converted into the type of X'Range. I can make this clear by exanding the code:
procedure Test
is
subtype X_Range is Natural range 1
subtype X_String is String (X_Range);
A : constant Integer
B : constant Integer
X : X_String;
begin
X (B)
end Test;
if you compile that:
>gcc -x ada -gnatwa -c test.adb
test.adb:10:07: warning: value not in range of type "X_Range" defined at line 3
test.adb:10:07: warning: "Constraint_Error" will be raised at run time
Integer and the range of the X are different types and need to be converted. Most C programmers just don't know how often type are convertet. Try http://www.splint.org and see how often a type is converted in your programs. Of course, strictly typed languages help the programmer avoid type convertions. for excample in a loop:
for I in X'Range loop
No bound checks needed in that loop. I will iterate over every element of X - no more no less.
The usual Ada programmer spends only 1/10 of the time debugging when compared to a C programmer. He does spend a lot more time typing and analysing compiler output - But that is less painfull then debugging.
With Regards
Martin
Sorry for the bad formating:
If you compare with K&R then you should do so with Ada 83. They are of equal age.
Besides. I think that C is like an iceberg. On the first glace there is little but then under the waterline lurks desaster.
If you are a serious C programmers you have spend th $18 to get the official C standart.
So then compare your average C Tutorial with the Standart on "implicid type convertion".
Tutorial: compatible types are converted.
C Standart: about 3 pages which you need to read at least 3 times to understand them.
To return On-Topic: Without understanding those 3 pages - perfectly - you can't do secure programming in C.
Ok, you could use splint as well.
Martin
The only time a bound need to be checked is when a type is converted. As long as you are within one type no checks are needed since the bound are already garaneed.
With there are some many type convertions that indeed checks would be needed left right and center.
say for example:
auto char X[10] = "123456789";
auto char Y[20] = "1234567890123456789";
x = y;
C's problem is that the arrays y and y are convertet to char* and then assigned. Hence the bounds are lost.
Calling strcpy would make things even worse!
In Ada, Modula-2 and Pascal the arrays are not converted and the compiler will be able to check the bound at compiler time and will isue an error - since X is not large enough to hold the value.
Other example:
typedef char T[10];
f (T X, T Y)
{
strcpy (x, y);
}
Again C converts the arrays into char* and looses the bounds. You can pass to many chars into the function and compiler says nothing:
f ("1234567890123", "123456789012345");
Again in Ada this would not happen. And again no bound check would happen. The compiler knows from the used type that both strings are 10 characters and can be assiged savely.
This is called "design by contract". And with "design by contract" the compiler will be able to optimize away most bound checks. Or even do them at runtime.
There is actualy a language call "SPARC" which will evaluate all contracts at compile time ensuring that no contract will be broken at runtime.
Programming SPARC is hard - but if you do the fly by wire of an Boing 777 any broken contract will meen 600 people drown in the atlantic ocean.
The problem with C is that you can write a contract down:
typedef char T[10];
But the compiler ignores the contract afterwards.
Martin
The Problem with C is that the default is unsave and you have to go out of your way to make it save.
There are programming where it is the other way round. Ada for example is often described as the "save language" yet it does have all the "unsave" features as well.
Unchecked_Convertion will convert everything as long as the size is the same.
"for X'Address use Y'Address" will convert even when the size does not fit. And it is faster - no data copied.
Yes you have to type more - but even when most of you never did any Ada you will all know what "for X'Address use Y'Address" means and that it is indeed a nasty hack.
But I give it to the C comunity: Sometimes you need nasty hacks. But do nasty hacks need to be the standart behavior of the language?
Funny as you say that you type end faster then }.
:-(.
Have you ever seen a non english keyboard and where they hide the { } there.
On a german keyboard it is 3rd function 7 and 0.
That's 3rd function not just shift
Because what ready makes the end-user choke is when you store string longer then the allocated space.
S trings
And the end-user is more important then us programers.
Beside, if you allow for Libraries then there is:
Ada.Strings.Fixed_Strings
Ada.Strings.Bounded_
Ada.Strings.Unbounded_Strings
Martin
And the funny thing is that the STL was inspired by an much older library written in Ada.
As a matter of fact:
:= i + 1;
ISO/IEC 9899 Programing Language C : 538 pages
ISO/IEC 8652 Ada Reference Manual : 560 pages
ISO/IEC 14882 Programing Language C++ : 757 pages
I have got them all. I read them all.
So you are telling me that 22 pages less makes C a slim language compared to Ada?
And I wonder who truely has to many ways to do the same thing:
i = i + 1;
i += 1;
i++;
++i;
In Ada there is only one way:
i
Ada has a lot features - true - but they aren't duplicates. They are all usefull features.
Martin
Well next year there is a Language revision - with containers. Besides, before you claim there are no Container Libs for Ada you might at least try the simplest Google: http://directory.google.com/Top/Computers/Programm ing/Languages/Ada/Bindings_and_Libraries/
Ada actualy has container libaries which can store polymorfic objects - something neither C++ nor Java can. They can only store pointers to polymorfic abjects.
Martin
The law in Germany is clear: If you take on a Message for someone else you must deliver. Payment is not required.
One alternative is not to take the message in the first place. That is you have to filter right inside the smtp Server and reject the message with an error code.
Other alternative is to use IMAP and filter the mail into different folder.
An other alternaive is an opt-in service.
The last option is very successful in Germany.
With Regards
Martin
You are right. However I have also learned that the choice of programming language influences the amount of debugging needed.
One study says that the amount of bugs in Ada is 1/10 of that in C. And SPARC 1/10 of Ada.
I would also venture that the amount of debugging needed in Ada is 1/10 of that in C.
And while you still have to debuig an Ada programmer does not not spend a large part his life from then on in finding mistakes in his own programs.
With Regards
Martin
Yes D is interesting. Only, like Eiffel, it concentrates only on procedural contracts and lacks type contract.
SPARC, being based on Ada does have type contracts:
type Day_Of_Month is range 1 ..31;
BTW: The example won't work. It does not take into account the fact that math.sqrt(x) only calculates an approximation - which is truncated to long. Correct examples have been posted before - by SPARC hackers.
It is not a good sign that the D developers made such an obvious mistake.
With Regards
Martin