Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Oct 2000
Offline Last Active Jul 26 2016 05:06 PM

#5055240 Making Win8 touch applications using VS 2008

Posted by on 20 April 2013 - 10:21 AM

Some misinformation in this thread....


You can make win32 applications that respond to touch and that run on windows 8.


x86-based tablets can run win32 applications, only arm-based windows 8 tablets can't.


The win32 wm_gesture messages work on windows 7 and windows 8.


You can make win32 applications that respond to gesture messages using any compiler/IDE that works with the windows 7 platform sdk or later.

#5020849 accessing/modifying data in a tree structure (hierarchical skeleton)

Posted by on 12 January 2013 - 03:14 PM

Does the hierarchy change? If not, you don't need to store in a tree with actual parent-> child ptrs. Instead, store all the bones in an array/vector, and keep the index of each. Instead of traversing the tree, just look up using the index. Keep a map of strings to indices for lookup in asset loading / ui / scripting, but otherwise refer to joints by their index.

#5020802 Possible C++ scope issue with class and vector of pointers

Posted by on 12 January 2013 - 01:15 PM

Do vectors allocate contiguous memory if initialized to size? I assume vectors can't do that when using push_back()? or maybe they re-create themselves after every added element so that it can fit into contiguous memory?

That's an astute question. In addition to setting the number of elements on construction as suggested above, you can also use vector::reserve to ensure a reasonable amount of space is available, without actually changing the number of elements 'in' the vector. This allows you to control when the allocation occurs, while still allowing you to use push_back or insertion iterators. While that's no better in this case, it's worth knowing.

#5003457 Loading and caching resources

Posted by on 23 November 2012 - 06:12 AM

You may find that you end up needing more additional attributes on your cached assets, in which case you may want to use a small struct (with appropriate comparison operators) as the key, instead of a string.

#5003218 Help with String Hashing

Posted by on 22 November 2012 - 06:26 AM

You probably don't want a 'real' hash function for this - just associate each string with an integer. For example you could start at zero increment for each string added, putting them as key and value in an std::map. Things get more complicated if you want to remove strings and reuse integers, but you probably won't need to.

Edit: turns out this is called string interning. Thanks Hodgman!

#5003215 Using Constants in Headers

Posted by on 22 November 2012 - 06:21 AM

As the constant is defined in a different translation unit, it's value cannot be known at compile time, only at link time.

#5001512 what would be the proper oop way to do this?

Posted by on 16 November 2012 - 06:17 AM

Assertion( Comparison( Adder( Integer(1), Integer(1) ).Result(), Integer(2) ).Result() ).Check();

Smalltalk says Hi (I wonder why it never got much traction Posted Image )

#4999299 Boost threaded application crashes

Posted by on 09 November 2012 - 08:44 AM

When you say 'crash' - what exactly is happenning? I.E. is it an access violation or what?

FWIW, it's not really worth doing your own threading for paralellism - it's simpler and more scaleable to use Intel Threaded Building Blocks or Microsoft Parallel Patterns Library.

Not that you have to of course - post more info and we'll try to help.

#4994063 what can i use to modify and hear audio in real time

Posted by on 26 October 2012 - 01:52 AM

You might want to invest some time in a course on signal processing too - luckily Coursera has one starting early next year.

#4993459 Favorite little known or underused C++ features

Posted by on 24 October 2012 - 09:32 AM


No seriously. I guess that says a lot about the codebases I've worked in ...

#4992477 Good C++11 resources for advanced programmer

Posted by on 21 October 2012 - 10:35 AM

From Scott Meyer's blog: the publisher of his Effective series, several Stroustrup books, and the Josuttis books has a 30-40% sale on c++ titles until 30th october.

Probably a good time to invest... Posted Image

#4992425 VS2010 - strange manifest error

Posted by on 21 October 2012 - 07:24 AM

That it works on the second build suggests a build order issue - a step of the build is expecting the output of another step to be available, but it's not - because it's built after the step that's complaining.

XXX.exe.embed.manifest is IIRC the intermediate manifest file which is later embedded as a resource in the exe.

If you look in project options, you can choose to generate the manifest either with "manifest tool" or with the linker. My guess is that you currently have it set so that the manifest tool generates the intermediate manifest file (.embed.manifest) and the linker embeds it, but the manifest tool build step is run after the linker step. If so, you just need to change "Generate Manifest" in the Linker//Manifest section of the project properties.

Quite why this is needed is beyond me - maybe the order the manifest tool and linker are used changed between versions? Possibly a 'fix' for the fact that in earlier versions of msvc the default project setup would embed the manifest on every build, breaking incremental linking.

#4991604 Good C++11 resources for advanced programmer

Posted by on 18 October 2012 - 06:14 PM

+1 for the Meyers ebook and the new edition of the Josuttis std library book. For a bit more depth on the c++11 std threading stuff, William's book is very good. On templates the Josuttis/Vandevoorde book is very good.

For const correctness and casting, you can see the c++faqlite

Microsoft's channel9 has some excellent videos - look out especially for Stephan T Lavevej's series and Herb Sutter's stuff on C++11. All the GoingNative and C++AndBeyond stuff is well worth a watch too. A good starting point might be Bjarne's Stroustrup's talk on C++11 style.

#4990897 I caught an exception! Yay! Now what?

Posted by on 16 October 2012 - 04:08 PM

I'm not sure this really helps you, but Visual C++ allows you to set it to break on the line throwing any exception deriving from std::exception (as well as as lots of windows-specific exceptions).

Maybe gdb has something similar?

#4987954 Discussion about the Static keyword

Posted by on 08 October 2012 - 05:37 AM

In general static is useful when used as intended - as a property or method of a class of objects.

Note, you say "at the object level" which is wrong - normal non-static properties and methods are properties of objects; statics are properties of classes of objects. You clearly know this already, but it's worth getting in the habit of making the distinction correctly :)

It sounds as though you have fallen into the trap of prematurely constraining your design. While static (and Singletons in particular) are often misused in this way, the problem is with the process of design - YAGNI