Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by jdhardy

  1. If you're using it as a scripting system internal to your game, then it will run on just fine on any desktop OS. If the scripts need to interact with the OS (opening files, etc.) then there are a few issues on non-Windows systems, but nothing major.   Non-desktop OSes (iOS, Android, WinPhone, Win8) are not yet supported. Getting the core to work on them wouldn't be that hard (except iOS, which doesn't allow runtime code generation), it just takes time.
  2. Quote:Original post by utilae ostringstream g_StrStream;//string stream What are the differences between the three and which do I need? i = input o = output no prefix = both You need an istringstream (or a stringstream), which uses a string as the source: istringstream iss("5"); int five; iss>>five; Or, with boost::lexical_cast: #include <boost/lexical_cast.hpp> int five = boost::lexical_cast<int>("5");
  3. Quote:Original post by cnstrnd To follow on this particular subject : How can one be sure the virtual functions in the v-table are ordered the same by different compilers ? You can't, but in practice, they usually are. Multiple or virtual inheritance isn't as likely to work, however. As long as you use interfaces with no base classes and only virtual functions, and the member function parameters are interfaces or primitive types, you should be OK. This is basically a cheap version of COM. Pretty much every Windows compiler uses the same vtable layout for this reason - compatibilty with COM interfaces. On other platforms you only have one compiler to worry about, so it doesn't really matter.
  4. jdhardy

    std::list speed issue?

    Quote:Original post by Driv3MeFar Quote:Original post by SiCrane Iterating through a list is actually very slow. In order to go through the list you need to dereference the next pointer of each node. This causes the cache to turn into mush. You may want to consider a std::vector or std::deque instead. They both have better cache locality than a std::list. Just out of curiosity, if the std::deque in non-contiguous in memory, how is it faster to iterate through than a linked list? Does it try to be as contiguous as possible, or is it just STL magic? A deque is an array of arrays. Each chunk is contiguous, but the chunks are not contiguous with each other. The locality is still better than a list, but not as good as a vector.
  5. jdhardy

    Vista w/o DVD Burner?

    Quote:Original post by KulSeran You can however boot off the disk if you have a virutal computer that can see the disk. Thus, if you get a copy of VMWare or a similar program, you can run that from inside your regular OS, and then boot the virtual ISO drive inside VMWare and test your OS there. I'd just like to add that this works great with the free VMWare Player - just use www.easyvmx.com to generate the VMX file.
  6. It works for me (well, as well as any other intellisense) on VS 2005 EE. Try deleting the .ncb file for your project/solution (close the IDE, delete the file, and reopen the IDE). C++ is really nasty to parse, and "simple" errors can hose the intellisense database (the ncb file).
  7. Don't use those functions, because they're unsafe? IF you feel like living on the edge, disable warning 4996: Project->Properties->C/C++->Advanced->Disable specific warnings EDIT: Wait, string.h class? If you're using C++ and you want the C string functions (strncat, strncmp et al.) use #include <cstring>; if you want the C++ std::string class, use #include <string>. If you're using C, string.h is still valid.
  8. jdhardy

    Polymorphic array.

    Quote:Original post by Endar Quote:Original post by deathkrush Don't store pointers in a std::vector, it's a bad idea. Try Boost Pointer Container, it's made specifically for that task. Why is it a bad idea? I do it all the time and the only problems I've had is when I've forgotten to do something important. It handles all of the pointer nastiness for you, and is (marginally) more efficient than std::vector< boost::shared_ptr< Base > > >.
  9. To add to what Dave said, always remember the rule of 3: If you need a copy constructor, assignment operator (operator=), or destructor, you probably need all three.
  10. jdhardy

    C++ Reference books

    Quote:Original post by xEricx Stroustrup's book is a great REFERENCE, but its kind of boring to read, so don't expect to learn C++ from it (I did, and it was a pain in the a...) I concur. Once you know C++, it's indispensible, however. Stroustrup and Josuttis will cover 90% of what you will need.
  11. Quote:Original post by owl I've read that to use dynamic_cast I RTTI must be enabled. Is it enabled by default? I'm using gcc. Yep. Most compilers are smart enough to turn on RTTI if they encounter a typeid() or dynamic_cast<>, or issue an error if they are used with RTTI off.
  12. Quote:Original post by snk_kid Quote:Original post by Tertsi I just don't get why they don't just supply lib or dll and include files and be done with it. At least I couldn't find any lib files installed. This is due to a number of reasons mainly the fact that boost strives for cross-platformance and support a large range of different C++ compilers. All these C++ compilers have different levels of standard compliance and anything that is platform specific is obviously different on each platform like OS filesystem. So each of boost libraries needs to be configured to work correctly on the each compiler and/or OS platform. There should be prebuilt libraries for VC7.1 and VC8 for 1.34, last I heard.
  13. Quote:Original post by Tradone right now i'm looking into bytestream binary save / load boost::archive::binary_oarchive/boost::archive::binary_iarchive. If you want to stay in memory (i.e. not use a file), use std::stringstream. You should be able to do compression using Boost.IOStreams, which provides gzip and bzip2 compression filters. Writing an encryption filter wouldn't be too much work, if you had a suitable encryption library (Crypto++).
  14. Quote:Original post by Promit SQLite isn't really meant for deployment on the web though...is it? Like most things, it depends. It's concurrent write preformance is dismal, since it looks the whole database (file). For read-only or single writer (say a blog) systems, it should be sufficient. Because you don't need a DBMS daemon running, it's also possible to use it on hosts that don't have a database server. Plus, administration is trivial - creating and deleting files is all you need to do. I have no idea how well it scales with concurrent readers, though. There's also an ASP.NET adapter that works well enough for my purposes.
  15. jdhardy

    I must know

    You won't be getting HDTV (High-definition TV), just DTV (digital TV). Basically, same content, same resolution, same quality, but uses less of the signal spectrum. Of course, this is about money, and the US government stands to make about $10 billion on the sale of the now-free spectrum, part of which will be used to subsidize converter boxes for those without TVs capable of handling the digital signal. This isn't about pushing HDTV, it's about making boatloads of money selling the now-free spectrum (Intel wants part of the 700MHZ TV band for WiMax, since it has much higher range the the 5.8GHz band they are working in now).
  16. jdhardy

    Visual Haskell

    http://msdn.microsoft.com/vstudio/extend/ One of the examples they ship integrates IronPython with Visual Studio. Unfortunately, it requires VS 2005 Standard or above, so Express users (like me)) are out of luck.
  17. Declare the list as mutable (i.e mutable CLinkList list;) inside CPolynomial. This will allow const member functions to modify it. Alternatively, consider using std::list so that you don't have to modify the state while iterating over it.
  18. Or using Boost.Assign: #include <boost/assign.hpp> #include <vector> std::vector<int> int_vec = boost::assign::list_of(1)(2)(3)(4)(5)(6)(7)(8)(9);
  19. Quote:Original post by Anonymous Poster windows has always included wow(windows on windows) software emulation to support legacy apps from even 16 bit windows on current versions of windows. WOW is not emulation, in the same sense as VMWare or an NES emulator. It's a set of shims that allows 32-bit processes to call into 64-bit functions, but there's no emulation of instructions or virtual machine involved. There's also WOW32, which was introduced with Windows NT to allow 16-bit processes to run on a true 32-bit kernel. Both AMD and Intel x86-64 processors require WOW64, for the same reason that all current x86 processors require WOW32 to run 16-bit prosesses on NT-based systems. x86-64 processors running in 64-bit mode (ie, under Windows XP x64 or 64-bit Linux) cannot run 16-bit processes since the 64-bit mode does not recognize the 16-bit registers. When running in 32-bit mode, they function exactly like a "normal" 32-bit processor.
  20. jdhardy

    Where is MFC 8?

    Quote:Original post by arithma Is support for MFC cancelled as a whole paradigm? Pushing up daisies. Look into ATL/WTL if you want to stick with C++. There are plenty of articles at CodeProject to get started. Otherwise, C# provides a much nicer development environment for GUI-based programs (IMHO).
  21. 3. The paramaters of fcould be anything if operator, is overloaded for any of the types involved. All you can say for sure is that there's four of them.
  22. jdhardy

    Member Function List, Boost.MPL

    What would be your ideal syntax? I agree that it's very noisy, but I don't know if it can get much better without using the PP. REGISTER(string), (MEMBER_FUNCTION("+", &string::operator+)) (MEMBER_FUNCTION(":=", &string::operator=)) ) Something like the above *should* be doable if you want to use Boost.PP. Overloaded functions could be interesting, though, as could constructors. Of course, with built-in reflection this wouldn't be necessary, but what can you do...
  23. jdhardy


    Quote:Original post by nagromo Yeah, the Opteron is a server CPU. The Athalon 64 should beat it in gaming, though. They're designed for different tasks. There's no difference between an Socket 939 Opteron 1xx and an Athlon 64. They're the same chip with different labels.
  24. jdhardy

    Member Function List, Boost.MPL

    Is something like the following what you are looking for? template<const char *str> struct string_ { string_() : string(str) {} const char *string; }; template<char *NameT, class MemFunT> struct member_function { typedef string_<NameT> name_type; typedef MemFunT function_type; member_function(function_type ftype) : pointer(ftype) {}; name_type name; function_type pointer; }; template<class T> struct reflection {}; struct test { int foo() {return 1;} int baz() {return 2;} int bar(int b) {return b;} }; namespace { char foo_name[] = "foo"; char bar_name[] = "bar"; char baz_name[] = "baz"; } template<> struct reflection<test> { private: typedef int (test::*foo_func)(); typedef int (test::*baz_func)(); typedef int (test::*bar_func)(int); public: typedef test class_type; typedef boost::fusion::tuple< member_function<foo_name, foo_func>, member_function<bar_name, bar_func>, member_function<baz_name, baz_func> > member_function_types; reflection() : class_name("test"), member_functions( member_function<foo_name, foo_func>(&test::foo), member_function<bar_name, bar_func>(&test::bar), member_function<baz_name, baz_func>(&test::baz) ) {} std::string class_name; member_function_types member_functions; }; I'm not sure about the namespace {} trick - it might trigger an ODR violation. It also doesn't let you map function pointer to names...yet. That might be possible with map<string, make_variant_over<memeber_function_types>::type>, but I haven't tried yet. All of this generated code could be wrapped in some PP macros to make it nicer. If I'm not even close to what you need, prod me in the right direction.
  25. jdhardy

    Member Function List, Boost.MPL

    Member function pointer are valid template arguments, believe it or not. I don't have a copy of the standard but my copy of Stroustrup says that template arguments can be "a constant expression, the address of an object or function with external linkage, or a non-overloaded pointer to member." (Pg 332). So that might give you some other thoughts. Also, unless you need to store these lists somewhere (at runtime), building a container that maps types to values should be possible. In the Spirit dir in Boost there's a library called Fusion that has a lot of what you would need. Unfortuantely it looks like the fusion::map (which maps a type to a value) is part of Fusion-2, which isn't part of Boost. However, fusion may give you some of the tools you need to get started. A fusion::tuple of pairs might do the trick, since you can treat fusion tuples as mpl sequences, and use the mpl find algorithms on them. If you need to generate reams of code, well, there's always Boost.Preprocessor [smile]. I've been thinking about something similar myself, but in the end I always fall back on Boost.PP to do the heavy lifting.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!