Data alignment and compiler padding say hi!
The CPU has no notion of type, what it gets in its 32-bit (or 64-bit, or 128-bit (SSE), or 256-bit (AVX) - let's keep it simple at 32) registers needs to be properly aligned in order to be processed correctly and efficiently. Imagine a simple scenario...
You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool th...
How can it be? Isn't the memory of a local variable inaccessible outside its function?
You rent a hotel room. You put a book in the top drawer of the bedside table and go to sleep. You check out the next morning, but "forget" to give back your key. You steal the key!
A week later, you retu...
It is so fun when you get a phone call from your brother who is failing highschool math and you have to waste an entire afternoon teaching the schmuck all the while asking yourself how you two are related.
I can already hear him saying: "I don't care how it works, just give me the formula."
@thecoshman No. I spent the weekend in my garden. Since I currently have no kids to take care of, there was no need to leave last night, and I decided to go home and prepare for work on Monday morning. Now it is Monday morning, and I don't feel like going to work. Really, is that so hard to understand? You didn't go to work today thinking, "Thank god, it's Monday!", did you?
Ha, that was easy! I just called in at work and talked to my R&D boss. Now I have the day off! Yay, sunshine, here I come!
@sbi oh yeah, your garden is not by your house is it, bit of a drive away IIRC. And no, I came in this morning thinking, "I hope I get given the time off to go see my sister after her stroke rather then just having to go and face some the consequences when I get back"
@sbi I'll tell her that the Gorilla wishes her well :P from my understanding, it's not too bad. no mental or speech problems, though she is more or less paralysed down her right side, though it may not be permanent
@thecoshman FWIW, I once asked a boss of mine to get the next two days off to go to visit my father, who was just diagnosed with cancer. He told me to pack immediately, and we talk about how to compensate for that (accumulated overtime, vacation, unpaid vacation, whatever) after I came back. I did like that approach.
Yes, you are an employee, but you are also a human being, with relatives, beloved ones, and feelings. An employer should never forget that.
@thecoshman 15 minutes. And while I had a few beers last night (I had a coworker with his wife and child visiting), I didn't drink anything but orange juice this morning.
@Nils Oh, that is your problem?! OMG. You might want to get yourself a decent introductory text on C++. (That is the only place where you can do that.)
@Nils Post something that you think should compile, and ask away?
@DomagojPandža Not really. From a technical perspective there's nothing wrong at all with Windows Vista. They simply didn't quite show it to the users.
Being able to plonk with a picture is threatening to become my most favorite feature of this chat over Usenet. It's just so much more convincing. Only slapping an actual, stinking fish on their table could be better. (A man gorilla can have a dream, yes?)
But it leaves such a taste in one's mouth when you fail at the most important aspect which is the thing that sells it. There were some nice new foundations, the new driver model, the restructuring of DirectX, allowing for future iterations, although a bit failing with DirectX 10 (like OGL ARB failed with 3.0)
Vista will always be herp derp for me, even though there were some nice moves. Simply feels that way.
Some games have an excellent technical layout and design, but the experience is a plain sucky herp derp.
Gosh, it just occurred to me that the ability of the rest of the room to slap stinking fishes onto their table when they misbehave would be a strong incentive for newbies to very carefully read the newbie hints before posting here. A very strong incentive. Maybe I should go to meta and ask for such a feature??
@sbi maybe we need a fish bot? logs who it has seen, any body new get's a fish slapped on them, linking to the newbie hints along with a firm warning that we don't tolerate shit
@thecoshman My parser threw me off halfway through that. Care to elaborate?
OTOH, the ability of all the users to slap stinking fishes on each other's table would seriously threaten the peace of the room. Given the flag wars that come up once in a while, this would come very close to the very threatening atomic truce we had in the 80s.
@sbi we set up a chat bot. Chat bot automatically messages new people that they should go to newbie hints page and that we don't tale shit, along with a fish
@thecoshman There's no DM feature anywhere on SO, remember? So any fish you slap is seen, smelt, and needs to be cleaned up by everybody logged in. Mhmm. That does seem to be a serious downside of my idea. Too bad.
@Nils You ended up telling shit tales to your kids?
Anyway, there is no point in taking the day off because of the nice weather and then spend the day in front of the computer — even if you do this on the lawn, with insects humming around you. So I will log off now, and enjoy the sunshine. Have a great day at work/studying/procrastinating, everybody!
Guys. No raw pointers in C++ unless you really need them. Please. Especially for some poor soul who doesn't even know that operator new returns a pointer. Get a std::auto_ptr or a std::shared_ptr.
Realistically, such a thing could never exist. Consider - when you print to the console, where is that console handle coming from? When you refer to a function, where did that function come from? It sure doesn't exist physically on the stack of the function you called it from. That's right - it's...
+1 from me, too. We have beautiful concepts like RAII, ways of encapsulating stuff in an elegant matter, it would be a shame not to utilize them. And arguments of learning fall flat on the boundary of it not being a simple raw pointer lesson assimilation but more of a realworld problem.
@DeadMG no vote cast, I see what you are getting at, but I think you have avoided the question. From a more practical sense, he is asking "are there any languages with out the notion of a global name space, ignoring the fact that you have to have some things accessible from a 'global' scope, such as main and OS hooks"
RE:I posted again because nobody answered. And because my whole work is stopped by this.
Im Miguel Petersen and im currently having a problem with constant buffers in directx 11:
My Shader file:
cbuffer ConstantBuffer
{
float4x4 final;
float4x4 rotation; // the rotation matrix
floa...
I created application that uses DirectXMath.h library.
I compiled it in VS11 using v110 Platform toolset with no problem.
I wanted to compile my application so that it can run on Windows XP.
I changed Platform toolset in project properties to v100.
Now Visual Studio can't find include file Direc...
It is hard to determine with absolute certainty because of the way rounding works. If it is fairly close, it might just decide they're quite equal - or worse
Going from double precision to int, it's a bitchy ordeal.
@thecoshman I also take out the trash every once in a while, but that doesn't make me a garbage collector. And I curse all the way through, insulting the trash all the while. :Đ
Always use a smart pointer wherever you own resources. Owning them manually is extremely error prone and violates many good practices, like DRY.
Which one to use depends on what ownership semantics you need. unique_ptr is best for single ownership, and shared_ptr shared ownership.
As children d...
does std::list not work on pointers to the type already? such that, if you create std::list<T*> it is actually going to store pointers to pointers to your actual data?
I don't think so. I explicitly said that they were suitable for DAG and strict hierarchy in a comment and he did not suggest that the OP's structure did not fit those.
I think you first need to agree on whether or not the Node class owns its child nodes or not. Only then the discussion on smart pointers can become meaningful.
Using unique_ptr almost guarantees dangling pointers, and using shared_ptr guarantees memory leaks unless you also use weak_ptr (and dangling pointers if you don't). Doing the right thing explicitly is far simpler than trying to second guess tools which were designed for other purposes. — James Kanze2 mins ago
@JamesKanze `Using unique_ptr almost guarantees dangling pointers` - I'm having trouble seeing what you mean. Could you point to an example? — sehe6 secs ago
@dead I trust you are just displaying a dislike for the sport and not being as stupid as fail to understand how the players are considered worth the money they are
@DeadMG millions enjoy watching the sport, which provides a chance to expose advertising to millions of people. Thus you have something to sell, advertisement. In order to provide the best advertisement, and thus earn the most money, you need to be making a name for your self. That means they need to the very best players for the team, there are only so many players, thus the supply-demand results in them being worth the vast sums of money they are.
@thecoshman So worth it, all the premier clubs in English football are under massive debt, most of which is wages, and one of the only two good Scottish clubs has just collapsed because it paid too many wages?
besides, advertisement is of questionable economic value anyway
@DeadMG Much the same thing could be said for the games industry. Big money, but a lot of the companies involved are in debt or going broke all the time
@DeadMG sure, questioned by those who haven't studied it and just prefer to pick their conclusion in advance
@jalf I also believe that that industry is as dead as the dodo.
@jalf Well, I of course have not spent a massive period of time studying advertising. But logically, if Nike stopped advertising, those consumers would still spend their money, just somewhere else. Bad for Nike, but fine for everyone else.
@DeadMG I never said football clubs had good accountants. It is something they have to do, to balance the books quickly, they could just sell all their star players, but such short sited actions will result in the team falling down the leagues quickly
advertising is like software patents- the only thing it achieves is wasting our money trying to put one effectively equivalent company up over another
@thecoshman It's not just about that. It's about the fact that like, 80% of their expenditures are player wages, and they racked up virtually all their debt buying new players.
Well, you can take cigs as a fine case study. They where spending vast sums on trying to out advertise each other. At some stage, such advertisements where banned. The companies come out better, as they could keep all that money, and not have to worry about competition out advertising them
and, IMO, can quite badly bend the competitive markets, in that a company with an inferior product but superior advertising can outsell a company with a superior product- even though it would be in the interests of the consumer in general for the superior product to succeed
@Neil Well, I don't mean literal, physical cash, but some activities do directly create money, for example, if you mine, then that ore/whatever did not have any value before you extracted it from the Earth.
@Neil Those people who spent that money buying Nike trainers because they saw Nike on a shirt of some footballer in the European Cup, would simply have spent that money somewhere else if it had not been there.