It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
avatar
Bookwyrm627: Why wouldn't your java compiler allow that to compile? "something" will be initialized by the incoming argument when the method is called, so it has an int value for the while comparison and walkroads (assuming it exists and takes two ints for arguments) should be called on each while interation.

If you tried to call meaning with something besides an int, then the compiler still wouldn't trip over this method because the method signature would indicate some other method named "meaning" should be called.
avatar
Alaric.us: Yea, that code seems like it should be able to compile. If, when running it, you screw up and try executing meaning without giving it an int that it expects, only then should it error out.

I guess all languages and all compilers are different in how they handle things.

Kind of like ... people on a forum. o_O
Oh, come on, we were really just about to agree on how everything is this time :p

But yeah, probably there will be warnings, errors or possible uninitiated values no matter what compiler you're using. But because you pass a basic type, there has to be a value assigned to it, and you imply the evaluation in the loop is valid. If it's an object class, and it has evaluation methods for the object declared and implemented, that then you can use in these checks, and so on, you end up being able to tell at compiletime if the check is valid.

Really neat stuff. So you could create an object that must be inside valid ranges based on some criteria you set, for example. Whether you use enums or just make something from scratch, seems to work well. And then the compiler stops you from allowing a possible fail condition like this, was the point :p

This.. still is a sort of metaphor for the forum rules, isn't it..
low rated
avatar
Alaric.us: Yea, that code seems like it should be able to compile. If, when running it, you screw up and try executing meaning without giving it an int that it expects, only then should it error out.

I guess all languages and all compilers are different in how they handle things.

Kind of like ... people on a forum. o_O
avatar
nipsen: Oh, come on, we were really just about to agree on how everything is this time :p

But yeah, probably there will be warnings, errors or possible uninitiated values no matter what compiler you're using. But because you pass a basic type, there has to be a value assigned to it, and you imply the evaluation in the loop is valid. If it's an object class, and it has evaluation methods for the object declared and implemented, that then you can use in these checks, and so on, you end up being able to tell at compiletime if the check is valid.

Really neat stuff. So you could create an object that must be inside valid ranges based on some criteria you set, for example. Whether you use enums or just make something from scratch, seems to work well. And then the compiler stops you from allowing a possible fail condition like this, was the point :p

This.. still is a sort of metaphor for the forum rules, isn't it..
C can be a bit confusing in this respect. If there is a function prototype in scope, the compiler can and will check against the prototype. So, in my example, if we had the prototype for printf(const char *, ...) in scope, the compiler won't let me pass an integer as the first argument. (I note that, if the prototype ends with "...", the remaining arguments are not checked.)

If there is no function prototype, then no type checking is done. Variables smaller than ints are converted to ints, and floats are converted to doubles. (This means that if the original function expects a float, and it is called from another file with no prototype in scope, you will likely get the wrong result.) If the number of arguments doesn't match, the call will be allowed to go through, and if there weren't enough arguments passed, the function will just use whatever happens to be in the next register or stack location (depending on the C ABI in use), and if the stack is used, I could see an assignment to such variables overwriting important information on the stack.

Modern compilers can warn against many cases that you would expect to fail, but not all, and some of them not unless you enable all warnings. Remember, C does not check these sort of things.

One thing that C *does* prevent that assembly language lets you do is forgetting the return instruction. If you forget to return at the end of a function, the CPU will just continue executing whatever happens to be next in memory, with potentially unpredictable results. There's also the stack; in assembly (assuming the CPU has a hardware stack), if you don't pop the same amount you push, then the return instruction will jump to the wrong location in memory, leading to unpredictable results (possibly including an "Illegal instruction" error).
avatar
dtgreene: Modern compilers can warn against many cases that you would expect to fail, but not all, and some of them not unless you enable all warnings. Remember, C does not check these sort of things.

One thing that C *does* prevent that assembly language lets you do is forgetting the return instruction. If you forget to return at the end of a function, the CPU will just continue executing whatever happens to be next in memory, with potentially unpredictable results. There's also the stack; in assembly (assuming the CPU has a hardware stack), if you don't pop the same amount you push, then the return instruction will jump to the wrong location in memory, leading to unpredictable results (possibly including an "Illegal instruction" error).
Guess I'm worse than spoilt after only using java - really interesting. So it's actually possible to create the same types of checks in C. But since you're targeting a very optimized and hopefully quick compile target, you still might favor these quick and dirty routines with a couple of huge pitfalls? That tend to actually work well enough, as long as the input is structured..?

..I'm not doing this metaphor thing on purpose, I swear.
avatar
LiquidOxygen80: People were just a lot more polite about what they worded.
avatar
PaterAlf: This.

Back then there were also some assholes and some hard discussions. But most of the time people expressed there oppinions quite politely and respected or at least tolerated other points of view. Today it's "Fuck you!", insults or name-calling within seconds. I think we really should stop that and try to discuss more respectful again. I mean is it really so difficult to discuss stuff in a civilized manner? One simple rule should help: Just write stuff that you would also say when you are in the same room with your conversational partner. If everybody would do that 95% of the insults would be gone and the forum would be a much better place again.
I feel like the politeness you spoke of was for a large part because of a percieved social consequence to your actions. Here on the Internet, there are no such consequences, and what little consequences are there (e.g. being banned from a forum or blog discussion) can be so easily circuvented that they are practically meaningless. On top of that, a place like this (or any kind of blog of arena for discussion) gives any garden-variety asshole an instant audence.

And all on top of that, the Internet allows you to conveniently dehumanize whoever is on the recieving end of whatever you're saying. I fully agree with your sentiment, but when people simply couldn't care less about whatever effect their words have on others, such a message falls on deaf ears. In their world, they are automatically entitled to have unlimited freedom to do or say whatever they want, whenever they want, with no regard for anyone else at all. If you don't like it, you're just another "special snowflake". Fuck other people.
(left hand middle finger) Internet (right hand middle finger)

Fuck words. We're at sign language now, bitches.
low rated
avatar
Emob78: Fuck words. We're at sign language now, bitches.
I just did a Fuck You to everyone and inserted my middle finger in my anus.
avatar
Emob78: Fuck words. We're at sign language now, bitches.
avatar
Kleetus: I just did a Fuck You to everyone and inserted my middle finger in my anus.
You'll end up with less shit on the end of that finger than the ones you use while typing on this forum. That's a fact, Jack-eetus.
deleted
low rated
Watching Hickory aka dtgreene get what they deserve priceless.

Some good popcorn

For those that don't know Hickory aka dtgreene plays neverwinter nights and fairly well known/ hated person.
Every single person in the modding community hates them.
low rated
avatar
Regals: Watching Hickory aka dtgreene get what they deserve priceless.
Except they aren't the same person.
Hey guys, just re-emerging from the abyss of the forum to say thanks for some of the fruitful exchanges and some helpful insights discussed on here. I definitely have plenty of ideas regarding what you fine people might want from the forums, and where there's room for improvement. If that's OK with you all, I'd like to keep this thread going for now (seeing as the new thread that was meant to help us all get away from the rabbit trails of this thread) and discuss some of the points with you further down the line. I have roughly three hundred millions pages of notes, so please do hang in there while I sit down and try and make some sense of it all :)
avatar
fables22: Hey guys, just re-emerging from the abyss of the forum to say thanks for some of the fruitful exchanges and some helpful insights discussed on here.
Did you need pointers on C trivia? don't know what else you could possibly have gathered from this discussion


Edit: is this thread bumplocked?
Post edited November 21, 2016 by WBGhiro
avatar
fables22: Hey guys, just re-emerging from the abyss of the forum to say thanks for some of the fruitful exchanges and some helpful insights discussed on here.
avatar
WBGhiro: Did you need pointers on C trivia? don't know what else you could possibly have gathered from this discussion

Edit: is this thread bumplocked?
If you go all the way back to the beginning, the first couple pages are actually semi-decent! :)
avatar
WBGhiro: Edit: is this thread bumplocked?
You mean it is showing as if you have read all messages in here? That is because the OP is downrated. Whenever that happens the name of the thread looks the same as if you had already read it, regardless of there being new posts or not.
deleted
Post edited November 21, 2016 by Fairfox