Interesting technique used in some Legacy code!
-
OriginalGriff wrote:
I can't remember FORTRAN syntax any more
Getting old?!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
I haven't used it for years - and archive retrieval is a lot slower than online storage! :laugh:
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
-
I haven't used it for years - and archive retrieval is a lot slower than online storage! :laugh:
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
OriginalGriff wrote:
archive retrieval
Magnetic tape at 300 baud? Does the tape reader still work with current Windows?
-
This was at the top of the code:
#define 300 1
#define 100 0I'm amazed that the compiler even accepted it! :rolleyes:
"State acheived after eating too many chocolate-covered coconut bars - bountiful" Chris C-B
As a side-effect, wouldn't it change
30000
to0
via30000
->100
->0
? -
This was at the top of the code:
#define 300 1
#define 100 0I'm amazed that the compiler even accepted it! :rolleyes:
"State acheived after eating too many chocolate-covered coconut bars - bountiful" Chris C-B
-
OriginalGriff wrote:
archive retrieval
Magnetic tape at 300 baud? Does the tape reader still work with current Windows?
I wish! This is the long term storage between my ears we are talking about here... :laugh: I just wish I could find a way to re-index it occasionally ;)
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
-
What happens then when you try to divide a number by 100? Just curious ^^
There are two kinds of people in the world: those who separate humankind in two distinct categories, and those who don't. "I have two hobbies: breasts." DSK
I guess, if you did try to do that, you would get a 'divide by 0 error'. Fortunately its only a small project and neither 100 or 300 were ever used as absolute values. It loaded a int with either 300 or 100 (ie 0 or 1) then later it checked to see if that int was equal to 300 or 100 (ie 0 or 1), so it did work but not a technique I would recommend! :rolleyes: :-D
"State acheived after eating too many chocolate-covered coconut bars - bountiful" Chris C-B
-
I guess, if you did try to do that, you would get a 'divide by 0 error'. Fortunately its only a small project and neither 100 or 300 were ever used as absolute values. It loaded a int with either 300 or 100 (ie 0 or 1) then later it checked to see if that int was equal to 300 or 100 (ie 0 or 1), so it did work but not a technique I would recommend! :rolleyes: :-D
"State acheived after eating too many chocolate-covered coconut bars - bountiful" Chris C-B
-
No, that implies the wrong thing. The compiler stored all it's constant values in memory locations, so it could happily pass a reference (or more accurately in those days a machine code pointer) to a constant value and it would act like a variable. Total PITA to debug when you met it for the first time: and a hanging offence to leave in production code...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
Changing the value of a literal for subsequent uses of the same literal is pure evil. Who could have ever thought, it was a good idea to implement constants that way? :omg: Was it possibly done to keep the image size of the executable small?
The good thing about pessimism is, that you are always either right or pleasently surprised.
-
Changing the value of a literal for subsequent uses of the same literal is pure evil. Who could have ever thought, it was a good idea to implement constants that way? :omg: Was it possibly done to keep the image size of the executable small?
The good thing about pessimism is, that you are always either right or pleasently surprised.
Probably - everything was kept small in those days: we didn't have anywhere near as much disk space as you do cache! If I remember rightly, it was a GEC4070[^] - so the main memory would have been 512Kb - and a dozen users using it...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
-
Well, the good news is it wasn't hidden away in a header file... :omg: If it's any consolation, A FORTRAN compiler I used to work with years, and years ago would accept a constant value as a function parameter, and let you change it at run time. I can't remember FORTRAN syntax any more but it would be similar to:
void MyMethod (ref int i)
{
i = 666;
}
...
Console.WriteLine(42);
MyMethod(42);
Console.WriteLine(42);Would happily print: 42 666
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
Oh that's some exciting crap right there.
-
This was at the top of the code:
#define 300 1
#define 100 0I'm amazed that the compiler even accepted it! :rolleyes:
"State acheived after eating too many chocolate-covered coconut bars - bountiful" Chris C-B
You forgot ;P
#define true 0
#define false 1
#define maybe trueMy programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!
-
No, that implies the wrong thing. The compiler stored all it's constant values in memory locations, so it could happily pass a reference (or more accurately in those days a machine code pointer) to a constant value and it would act like a variable. Total PITA to debug when you met it for the first time: and a hanging offence to leave in production code...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
Geez, I have never actually seen an example of this, but our Fortran and Data Structures instructor mentioned it once on a really old version of Fortran IV.
"Seize the day" - Horace "It's not what he doesn't know that scares me; it's what he knows for sure that just ain't so!" - Will Rogers, said by him about Herbert Hoover
-
Geez, I have never actually seen an example of this, but our Fortran and Data Structures instructor mentioned it once on a really old version of Fortran IV.
"Seize the day" - Horace "It's not what he doesn't know that scares me; it's what he knows for sure that just ain't so!" - Will Rogers, said by him about Herbert Hoover
You're just trying to make me feel old, aren't you? Well it won't work, I tell you! I have a wife who has that job covered... :sigh:
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
-
You forgot ;P
#define true 0
#define false 1
#define maybe trueMy programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!
Super Lloyd wrote:
#define true 0
#define false 1
#define maybe true || falseFTFY ;P
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
-
Super Lloyd wrote:
#define true 0
#define false 1
#define maybe true || falseFTFY ;P
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
Much better way of defining maybe, love it! :-D
My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!