Posts for Warp


Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Nach wrote:
In C++, you should be using std::unique_ptr and std::shared_ptr to avoid a lot of the issues
They help only if you allocate individual objects dynamically. They don't help if you have eg. a container of objects (such as std::vector or std::set), nor do they help with stack-based objects. The vast majority of C++ programs don't need those for the simple reason that objects are usually handled by value, or you are using well-encapsulated data containers to handle them (such as the standard ones). The danger of dangling pointers is still there regardless, though. Note that you don't even need to use literal pointers to get a dangling pointer. It's enough to use iterators. And they can happen inadvertently. One example situation is having a class like this:
Language: cpp

class Something { std::list<SomeType> elements; std::list<SomeType>::iterator currentElement; .... };
One easily forgets the so-called "rule of three" in the above class because nowhere in the class is there a 'new' or 'delete' (which is usually the instinctive trigger for an experienced C++ programmer to start worrying about the rule of three.) (The problem in the above class happens if you copy/assign it, if it doesn't have the proper copy constructor and assignment operator defined.)
and in the case you describe where you may point to something that is no longer there, it actually exists in Java as well - NullPointerException.
That's not a pointer that points to a destroyed object (because it's impossible for an object to be destroyed in Java if there's a reference pointing to it). It happens when you use a null reference, which is completely different. In C++ accessing a destroyed object is undefined behavior and can cause debugging nightmares (and even disastrous bugs). It might not even cause problems every time, but only sporadically. In Java accessing a null reference is very much defined behavior and will not cause any havoc. (Sure, it's indicative of a bug, but it's not dangerous. It simply throws an exception.)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Guga wrote:
YounigJ, fyi, look at the date of those posts. The period between them is really large. So, it isn't tripleposting.
Even if they had been posted 10 seconds apart, so what? Who cares?
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Patashu wrote:
Does it involve a race condition?
No. It's also a circular situation, but slightly different. It happens, for example, like this: Module X owns a (reference-counted) object of class Y. A member function of Y calls a function of X (and then does other things with itself). That function of X happens to drop the reference to object Y, causing it to be destroyed (because only X had a reference to it). As the execution returns to the function in Y, it will be operating on a prematurely destroyed object. (This isn't a problem in a garbage-collected system because the GC engine sees that there's still a "'this' pointer" pointing to the object, so it will never destroy it prematurely.)
Nach wrote:
I disagree. Many programmers prefer "safe" languages because certain bad features simply don't exist, and because of misconceptions about C++.
Actually what you say there and what I said are not mutually exclusive things. Many programmers do indeed prefer "safe languages" for misinformed reasons. However, many other programmers prefer to do so even though they are more or less quite well aware of how C++ works and how it's used properly (yet still prefer using another language where you don't have to worry about those things.) I know how to use C++ safely and effectively (during the past 10 years or so I don't remember having had a memory leak even once; I have had a couple of off-by-one access mistakes, and maybe a few other such errors, but nothing that directly relates to memory management per se), but I recognize perfectly well and accept that proper safe memory management in C++ necessitates more care and more design (that has to be done exclusively to make the memory management secure) that isn't necessary in other languages. There are many issues that are not handled even when strictly adhering to RAII design (ie. using the so-called "rule of three" and so on). I mentioned dangling pointers as an example (ie. pointers that might end up pointing to a destroyed object, causing undefined behavior if it's dereferenced). In those other languages there is no such thing as a dangling pointer for the simple reason that all objects are garbage-collected: If something references an object, it won't be destroyed. While this usually comes with the price of increased memory consumption and somewhat slower execution speed, many programmers are ready to pay that price for the comfort and safety.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
jlun2 wrote:
Yea, this is "absurdly" sexist.
I failed to see anything sexist about it. Yes, it had a nauseatingly stereotypical view of the American 50's nuclear family (the only thing that was missing were the 2 kids), but I didn't see anything particularly sexist in it.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
EEssentia wrote:
Still, AFAIK, my point on cyclic dependencies still holds.
In my experience the problems of reference counting are greatly exaggerated. They can happen, of course, but it's not very common in practice. PHP uses reference counting for memory management (or at least did it for a long time; I haven't checked the absolutely latest versions) and while you can indeed create cyclic dependencies that end up in leaked objects that never get freed, it doesn't happen all that often. (Yes, you can come up with a ton of situations where it happens inadvertently, but given the amount of PHP code out there, they are not something that people write very often in practice.) Objective-C (or at least Apple's variant of it using the Cocoa library) uses reference counting as well, and you can get cyclic references, but it happens rarely. (Although now with code blocks it can happen much more easily without you even noticing...) Btw, some object never getting destroyed because of a cyclic dependency is not the only problem that can happen with reference counting. It's also possible for an object to be destroyed too soon (and then code accessing the destroyed object). Can you figure out how this could happen? (And yes, it happens purely via the reference counting mechanism. I'm not talking about bypassing it and starting destroying objects manually and intentionally.)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
henke37 wrote:
RAII works badly with cyclic data structures.
I think you are confusing RAII with reference counting. Not the same thing. (For example std::list as a doubly-linked list and it fully utilizes RAII, like any other STL data container. It has no cyclicity problems.)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Link to video A common point of contention seems to be who the bald guy is. IMO he's clearly Kojak.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Nach wrote:
Or you could just learn C++, and make use of the STL containers with RAII, and stop worrying about memory management or any other kind of resource leakage.
To be fair, though, even RAII isn't a bulletproof technique to avoid memory management problems. For example, it does not help at all with mistakes like dangling pointers, so one needs to be aware of such things even when using just STL containers and nothing else. (It's enough to eg. add elements to a std::vector in order to invalidate any existing iterators/pointers/references to a previous element. Accessing the element through such an invalidated pointer is undefined behavior, and an very hard-to-find bug.) While RAII is really, really helpful in making programs safer and simpler, one still has to know the caveats and the ways to shoot oneself on the foot. This is the reason why so many programmers prefer so-called "safe" languages (such as Java and C#) where such things just don't happen(*), even if it means that the program will be a bit slower than the equivalent C++ program would be. (*) Null-pointer exceptions notwithstanding...
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Patashu wrote:
For alternatives to C, microsoft has 'Managed C' where you can declare objects to be within managed memory and a garbage collector will be freed later. Much of the mental work in making a C program work is in handling memory yourself, so this helps a LOT.
Memory management is one of the biggest headaches in C (as it offers little to no tools to make memory management automatic or even less error-prone), but it's certainly not the only problem it has. (Therefore a "C with garbage collection", while better, would still be a pain to code with.) Another big problem, from both a beginner's and an advanced programmer point of view, is that it lacks most of the useful standard library tools (such as data containers) that the vast majority of other languages offer. (The main reason why it lacks them is because the semantics of the language are so primitive that it simply doesn't allow creating good, efficient and high-quality generic data containers and algorithms.) It's good to know how data containers work internally, especially when you become more advanced (because it's important to know which data container is best suited for the task at hand, and what kind of benefits and drawbacks it has). However, unlike many people advocate, there's no need to learn these internal workings the "hard way". Implementing a data container from scratch can be an interesting task, but hardly essential if your only goal is to know how a certain type of container works internally. (There are other problems with C as well, but I won't start listing them here...)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
ais523 wrote:
I'd argue against JavaScript (basically because the library support sucks; the language itself has a few flaws but is interesting), and against PHP (badly designed).
I recommended those two languages not because they are masterpieces of computer language design, but because they are safe (you don't have to worry about segmentation faults and leaked memory and such things that are advanced stuff in unsafe languages), have immediate practical applications and because at least in the former case you can start immediately running your programs. In other words, with JavaScript you simply write your first "hello world" program and run it with a web browser. Nothing else is needed. No need to install IDEs, compilers, libraries... Everything you need is already installed in your computer. In the case of PHP you of course need to install the development environment to run anything, but the thing with PHP is that, while it's quite a sloppily designed language (especially for its libraries), it's widely used and learning it has practical applications. In both cases if you learn them well, you could even get a job. (That's hardly the case with more obscure languages like Lisp and Haskell, no matter how well designed and "beautiful" they might be.)
Nach wrote:
I would slightly argue that even if you don't develop with assembly, it can still be useful to know when debugging an application.
Even if that's so, it's a really advanced topic, hardly the first thing a newbie programmer should worry about. Also, it would only be relevant with low-level languages such as C and C++, not with higher-level languages like Java or C#. (In fact, they are so high level that they pretty much abstract away the whole concept of memory addresses and pointers. For example, references in Java are not what you'd think are just raw pointers. They are much more complex than that. They are much more complex to allow for garbage collection, memory compaction, runtime validity checks, and a bunch of other things.) Even when debugging a C/C++ program, my experience is different than yours. While knowing what the compiler is doing behind the scenes helps understanding what's going on and aids eg. in memory consumption optimization (as well as other optimizations, such as minimizing memory fragmentation), I don't see how it aids in debugging.
amaurea wrote:
C is a good low-level language
I beg to differ. C is a horrible language and I wouldn't use it unless absolutely forced to. I would even use Java any day instead of C. Just because C is used in almost everything (and to implement almost everything) doesn't make it a good language.
jlun2 wrote:
Search around the web for open-source projects written in the language of your choice (in this case, C++), and analyze the code to learn how other people program
This is one of the most common and by far the most misguided suggestions people make to learn programming. Reading other people's code is one of the hardest and most inefficient ways of learning programming. It's like trying to learn how to cook by examining a ready-made cooked meal. Suggesting someone to learn programming by examining other people's code is completely equivalent to telling someone who wants to learn to cook to "go to a restaurant, order a meal, and examine how it looks like". The proper way of learning to program is to read books and tutorials, enroll in programming courses, etc.
Derakon wrote:
I can see where ais523 is coming from regarding assembly. When I was learning to program, I had a horrible time trying to wrap my head around where stuff was coming from; it wasn't until I had a good mental model of how memory actually worked in a computer that I grasped how pointers work. Assembly is thus one possible way to establish that kind of fundamental understanding, and since the language is so simple there's basically no distractions.
Maybe if you are trying to learn C. Not all languages are C, nor do all languages use pointers or other low-level stuff. Learning asm is pretty much a waste of time if all you want is to learn, for example C# or JavaScript.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
ais523 wrote:
I'd start off by recommending against C for a first or second language; it's hard to understand and easy to get into bad habits about. It's definitely worth learning, but I'd suggest learning assembly language first
At first I was like "yes, that's good advice..." Then I was like "What?!" That's a bit like recommending someone who wants to learn painting to buy a book about chemistry. "After all, you need to know what the paint is composed of." If C is a bad choice as your first or second language, asm would be like a hundred times worse choice. You don't need asm for anything, especially not at the stage where you are learning the very beginnings of programming. Even 99.9% of professional programmers who have programmed for the last 20 years don't need asm for anything. (If you were making an emulator then the asm of the emulated hardware would be quite relevant. However, that's most certainly not a project for someone who is learning the basics of programming.) If you want to learn to program with something that's easy, safe and actually useful in practice, learn a scripting language such as JavaScript, ActionScript or Python. Another higher-level language with practical applications would be PHP (although the language and its libraries a design nightmare, but still.) If you want to learn a compiled language that has even a modicum of efficiency, try Java or C#. (The latter might be even better as a language, although with the caveat that you will basically be programming for Windows only. Yes, there are limited ports to other platforms, but in practice you will be restricted to Windows programming.) C++ is my personal love of my life, but it's quite a large project to learn properly, so it might not be the best first-time language.
Post subject: Re: steam user name
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
sack_bot wrote:
ZOMG! Im posting this coment on steam AND TASVideos AT THE SAME TIME!!!
Congratulations?
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
nfq wrote:
If you have to buy batteries, it becomes pretty expensive in the long run.
That's rather ironic coming right after I posted that I estimate spending about 21 euros per year on AA batteries for my game controller. (That's about 27 US dollars.)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Of course there's always the possibility of not using resets at all. No timing problems, no emulation problems, no controversy. But of course most people here are so enamored with resets that that's not going to happen anytime soon...
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
CoolKirby wrote:
except they require lots and lots of batteries throughout their lifespan.
I don't have that experience. In my experience 2 AA batteries last for about 2 weeks of relatively intensive playing (several hours of playing almost every day). Ok, it depends on your definition of "lots and lots", but I'd say that's a pretty decent playing time for just 2 AA batteries. Overall it's rather cheap. I can buy a pack of 8 such batteries for 3.5€, and even if I play rather intensively they last for at least 2 months. That's like 21€/year, which isn't bad at all. Cheaper than most rechargeable batteries (which don't last much longer anyways...)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
ElectroSpecter wrote:
So many funny things going on in this image =D
When searching for that book at amazon.com, it gives some interesting "Customers Who Viewed This Item Also Viewed" suggestions, such as: - Bobby Blanchard Lesbian Gym Teacher - How to Shit in the Woods, Second Edition: An Environmentally Sound Approach to a Lost Art - The best dad is a good lover - Games you can play with your pussy - The Haunted Vagina - Castration: The Advantages and the Disadvantages - The Beginner's Guide to Sex in the Afterlife
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Dead Island's trailer not on #1? Or even #2? 7th? Really? I know that everyone's entitled to their opinion, but seriously... (Also, "oh it also plays backwards, which is pretty cool." I have always wondered why everybody just says it plays backwards. It has backwards and forwards segments of the same scene, the backwards one starting from the end of the scene, and the forward ones starting from the beginning, and they meet in the middle. Now that is cool.)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
A tournament of what? (And at least you don't have Peach on your shirt...)
Post subject: Re: [Guide] Optimizing 3D Games TASes
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Grincevent wrote:
There is another thing with moving diagonally sometimes in 3D games, must depend on the game... (and I don't know if it happens with Quake) Simply put, it is faster to run diagonally (still in a straight line) than just forward, or any "cardinal" direction on the controller/keyboard.
Yes. Especially in older 3D games they had a very simplistic manner of motion where if you pressed forward it would move forward at a certain speed, if you pressed eg. right it would move right at that same speed, and if you pressed both at the same time, those two movements would simply be summed up (meaning that your total speed diagonally would now be sqrt(2) times your normal forward speed, ie. about 41% faster.) IIRC this was the case in Doom, which is why all speedruns of it always run diagonally most of the time. They "fixed" this in Quake where diagonal movement has the same speed as forward movement. However, as said, due to some quirk, if you change from forward to diagonal, for a fraction of a second you move a bit faster.
Post subject: Re: [Guide] Optimizing 3D Games TASes
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
THC98 wrote:
-First thing you have to know about 3D optimizing is that you must hold the perfect angle in your TAS Input for EVERY move, making you go in the most straight line to the next curve or obstacle
Actually that's not always the case. Quake is a very good example of this. Rapidly zig-zagging (ie. while moving towards your goal, alternatively press left and right) is faster than running straight. (AFAIK this is because of a small quirk in the game engine that makes you move slightly faster for a fraction of a second when you change direction, before your movement speed stabilizes to its intended maximum.) (Moreover, there's a way to move even faster by combining zig-zagging and bunny-hopping: Due to another quirk, if you jump immediately after landing from your previous jump, you don't lose any speed. This, in conjunction with zig-zagging, allows you to maintain speeds that are not possible by just running.)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
exdeath wrote:
I would love to see some ultra pacifist ultimate doom tas
I would love to see a Doom TAS (any kind) in the first place...
goofydylan8 wrote:
Holy Necropost Batman! This has to be the largest gap between posts on this site. Is there even another post on these forums that has the most recent reply older than this? The site was only like 1 month old at the time of the last posting.
And your point is?
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Sir VG wrote:
Wait until the very end of the video.
It says "www.konami.jp/mg25th".
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
YoungJ1997lol wrote:
I have one of the top comments in this video. You know, I think i should have put this in the crappy video section.
Now you will be banned by a tasvideos admin moral guardian who thinks that it's illegal to post pictures of children on the internet and fears that the site may be shut down by a lawsuit.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
pirate_sephiroth wrote:
not a trailer, but HOLY MACARONI... http://www.youtube.com/watch?v=yhDZDgyrTLc
Games are starting to look quite realistic. I'm really wondering if it will look that good on the Xbox 360 also. (And... are you sure it's not just a pre-rendered FMV?)
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Scepheo wrote:
I also made a bunch of maps. Although only one of them can be solved without using glitches. I know, maps that require glitches aren't exactly in the spirit of Portal, but these were made with runners in mind, and TASVideos isn't exactly shy of glitches either.
I think that the idea should be that the level is solvable faster by using glitches, not that glitches are the only possible way of solving it...