Brain mixed languages...

Dang. Just spent a half-hour hunting down a bug... I couldn't figure out where a bool value was getting flipped in code that was previously working...

Because in Object Pascal object creation automatically sets all member objects to reasonable defaults -- booleans are false, integers are zero, etc.

I forgot that in C++ you have no such guarantee...

I had changed a constructor with a defaulting argument value into two constructors: a default and one that takes an argument. (All for incremental testing purposes.)

So I finally figured out that the object was getting created with the bool value set. I like the Object Pascal object creation guarantee, and sometimes I forget that C++ doesn't do that.



Foo.
Wait, you program in Pascal?
Isn't it a dead language?
Why do you program in it? (job/fun/other)
What compiler do you use?
Would you recommend I learn it?
I been stuck on things that turn into incredibly trivial problems for ages...I then feel like i have to do something like a dance or a thread to celebrate the discovery.
¿didn't you receive a `variable is used before being initialized' warning?
Last edited on
closed account (1yR4jE8b)
Wait, you program in Pascal?
Isn't it a dead language?
Why do you program in it? (job/fun/other)
What compiler do you use?
Would you recommend I learn it?


I don't speak for Duoas, but at my work we have tons of legacy codebases all in different "dead" languages that we need to maintain and cant' just throw out because nobody else uses the language anymroe.

Anyway, if your curious about Pascal there is a Free Pascal compiler for Ubuntu/Linux called "fpc", the ubuntu package is 'fp-compiler' and the executable is called with `fpc`.

I would definitely recommend learning Pascal: the language design is clean, beautiful, and things make sense; it's one of my favorite programming languages. You could also check out Ada, which is somewhat of a C++ to Pascal's C. Ada is used exclusively by the US DOD, so you could get a job there :P
Last edited on
I too love Pascal. However, you'll note in my post that I said Object Pascal, which is Pascal's C++. (Embarcadero calls it Delphi.) While there are a few things I disagree with about the evolution of the language, it is easily one of the most modern, powerful languages out there.

If you've got the bucks for Embarcadero Delphi XE2, you've got a programming environment superior to just about anything else.

If not, you can use Lazarus, which comes installed with Free Pascal plus all the RunTime Libraries and components you'll need to develop GUI applications, etc. (You see, FPC doesn't come with the standard RTL, which you'll want even if you are writing command-line programs.)

Lazarus is very simple in comparison to things like Delphi XE2 and even Code::Blocks, but it is held together by a relatively small contingent of enthusiasts, and works well enough to do most common things.

I do recommend it.
http://www.embarcadero.com/delphi
http://www.lazarus.freepascal.org/index.php


I don't like Ada, it feels scrambled to me. But meh, whatever works.
nope it inherited random numbers some how
Ah, re: ne555's post:
¿didn't you receive a `variable is used before being initialized' warning?
.

No, default constructor that initialized nothing. Compiled with -pedantic. That's a pretty hard thing for the compiler to catch, though. (Even if, in this case, it could have pretty easily.)
Topic archived. No new replies allowed.