• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About AVigesaa

  • Rank
  1. Popular coding style?

    Monitor resolutions are growing, but so are the number and magnitude of IDE toolbars. Seriously, though, vertical space is still a scarce resource. If indentation adequately designates the start of a new code block, I don't see a valid reason for giving the starting brace its own line. It just seems wasteful. In VS2005, I get about 50 lines of code on the screen at once. It's difficult to find a reasonably dense screen-full of code that doesn't have at least 5 opening curly braces. I don't have any actual numbers on the frequency of '{' braces in C++ code, but I'd guesstimate that at least 15% of the non-blank lines in my source files contain a '{' brace. The second style carries a heavy cost for such a minor personal preference. I only give opening-braces their own line when indentation doesn't make it immediately obvious where the code block begins. Here are a couple of random examples taken from an old C++ project. // without the emphasized scope, it's hard to differentiate the multi-line // conditional statement from the code block. if(i->second.active == false && // not currently active i->second.backups.size() == 1 && // only one backup entry i->second.backups.front().memento == 0) // the entry has no memento { // ... } // likewise with lengthy initializer lists CSurface::CSurface(unsigned width, unsigned height) : PHAL::Surface(width, height, 0, 0, true), transparency(false) { // ... } // and functions with large number of arguments Entry::Entry(Action *action, LazyGFX::CSurface *icon, const char *label, const char *descr, unsigned resize_progress, bool focus, bool own_action_mem, bool own_label_mem, bool own_descr_mem) { // ... } Disclaimer: I don't advocate writing ridiculously compact, scrunched up code. Without approprate vertical segmentation, it doesn't take very long for code to become completely unreadable.
  2. OpenGL ES vs. Direct3DMobile

    Yes, I would say that using C# is responbsible for a lot of the speed difference between the two. I'd like to see your results using unmanaged c++/D3DM.
  3. OpenGL ES vs. Direct3DMobile

    Are you using C# for the D3D app, and native C++ for the OpenGL-ES app? Unless a lot has changed in the PocketPC world, I wouldn't count on doing any realtime 3d with C# on that platform (without hardware acceleration, at least).
  4. Some of the PocketPCs with video chips are really bus limited. You can't really do anything about it. I'd recommend picking up PocketHal @ www.droneship.com. It has a few tricks, and sometimes can give you small boost or two.
  5. C# = the future?

    Quote:Original post by seanw The vast majority of security problems that are plaguing the security world today are due to buffer overflows because languages like C and C++ gave programmers the option to not range check array accesses to increase execution speed. Exactly, C++ gives you the option of not checking your bounds. If you need bounds-checked arrays, write a safe-array type to do it for you -- it'll take about 5 minutes. Even better, just use std::vector. Now, to the best of my knowledge, I can't selectivly turn off bounds checking in JAVA or C#. I could be wrong, though. I've never needed to, because I wouldn't use those languages for things that require such micro-optimizations. My point: that's the difference between these language's paradigms. Similar, but higher level languages (C#/JAVA) do give you some nice features, but you're suffering their overhead whether it's neccessary or not. C++, however, will afford you much more freedom in selecting the features you want to use. You may have to implement those features yourself (and it may be a pain in the ass), but that's the trade-off for operating more closely to the metal. Is C++ harder to use? Sure. Is C++ economically efficient for most types software development? I doubt it. Sandbox-language programmers go for much less than competent C++ programmers, afterall. But saying that using C++ is inherently 'backwards' kind of misses the point. You're making lots of ignorant blanket-statements. You can blame the mis-applications of C++ (and that'd be valid -- it's misused alot), but you need to be more careful about what pitfalls you attribute to the language itself. Different tools for different jobs, and all that.
  6. question for java

    .equals() you mean?
  7. Faster Alpha Blending?

    Floats are a big no-no on PPC, especially on per-pixel operations. The PPC has no FPU, so it's emulating all those floating point calculations. It looks like there's about 6 multiplies, 6 adds, and 3 subtractions PER PIXEL. That's a lot of floating point arithmetic for a little ARM processor to emulate. Depending on how (or if) they're being inlined, all those helper functions might be a performance concern as well. The previous poster has the right idea.
  • Advertisement