Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About m-sambo

  • Rank
  1. m-sambo

    Removing Startup Data for a USB Flash Drive

    Many of the promotional flash drives are made so that the promotional material partition is read only. It is made that way by the makers of the flash drive using content supplied by the customer. It may be difficult or next to impossible to remove. Good luck. Mike
  2. Quote:Original post by SiCrane Oh, I should also mention that MSVC's member function pointer implementation is not standards compliant so this is a case where the standard isn't useful. It is for the above example and clause and that's what I need. :) Mike
  3. Quote:Original post by SiCrane Just because the compiler doesn't generate warnings doesn't mean it's safe. Too true. Quote:Original post by SiCrane If you compile the code in my post on MSVC 7.1 with the /vmg switch, the compiler will not emit any warnings, and the code will still crash the application (though, for what it's worth, it generates the correct output before crashing the application). when using /vmg you must also use one of /vms /vmv /vmm as well, did you include one of these? This is what the 14882-2003 Standard has to say on it which if I am reading it correctly in my original example it is valid C++. Quote: An rvalue of type “pointer to member of D of type cv1 T” can be converted to an rvalue of type “pointer to member of B of type cv2 T”, where B is a base class (clause 10) of D, if a valid standard conversion from “pointer to member of B of type T” to “pointer to member of D of type T” exists (4.11), and cv2 is the same cv-qualification as, or greater cv-qualification than, cv1.63) The null member pointer value (4.11) is converted to the null member pointer value of the destination type. If class B contains the original member, or is a base or derived class of the class containing the original member, the resulting pointer to member points to the original member. Otherwise, the result of the cast is undefined. [Note: although class B need not contain the original member, the dynamic type of the object on which the pointer to member is dereferenced must contain the original member; see 5.5. ] Mike PS Sorry about mistyping your name in the above post.
  4. Finally tracked down a copy of the standard and it does appear to be valid c++ if i'm reading it correctly. For those interested it is specifically covered in the static_cast section SirCrane's example doesn't work for me either but the compiler does generate warnings. This seems logical as the Base pointer being assigned to in main will have no knowledge of the Monkey class. That is the error with that code. Using SirCranes example if you create another class called MegaBase and derive it from Base and Monkey and then derive Derived from MegaBase and use MegaBase as the pointer type in main all is well and the correct output appears and no warnings are generated. Mike
  5. Yeah, my gut feeling is that it should be undefined behaviour and that it wouldn't take much to break it. Something like adding a member variable to the derived class or using multiple inheritence could do it. I read one post on Google that mentioned this, casting from Derived::* to Base::* , was specifically covered in the C++ standard but I don't have a copy on hand. I couldn't find it anywhere in the draft standard which I did find online. Mike
  6. Simple question. Is it legal to to do something like this, ie cast from derived class member function pointer to base member function pointer and then call this function in the base class via this pointer: #include<iostream> #include<vector> class Base{ public: typedef void (Base::*Bptr)(); private: std::vector<Bptr> mpra; typedef std::vector<Bptr>::iterator Mprait; public: void enter(Bptr entry){ mpra.push_back(entry);} void call_all(){ for(Mprait it=mpra.begin();it!=mpra.end();++it) (this->**it)();} }; class Derived : public Base{ public: void fxn0(){ std::cout<<"fxn0() called"<<endl;} void fxn1(){ std::cout<<"fxn1() called"<<endl;} }; int main(){ Base *b=new Derived; b->enter(static_cast<Base::Bptr>(&Derived::fxn1)); b->enter(static_cast<Base::Bptr>(&Derived::fxn0)); b->call_all(); delete b; return 0; } this example was posted by Hiram Berry and I turned it up on Google groups. I am doing something very similar with VC Toolkit 2003 and it appears to work but I can't get a consensus on whether it is legal, undefined or illegal. The main difference between this and my code is that I am doing what is in main in member functions in the derived class and I'm not using new to create by derived class object. It is a simple local variable. Mike
  7. Quote:Original post by Drew_Benton I am not saying you should use either or - its just from experience, I know that you want the most amount of data represented in the least possible size - of which the attributes method is superior to. If you need to see real proof of the size difference, I think I still have my map generator that switches between expanded names and short optimized names. I'm sure I can dig it out or just write another one. Good luck! - Drew Yeah in my case it makes a large difference in file size too. My editor is not a game map editor exactly but rather a mapping application for those that play interactive fiction. These maps are limited to rooms and connectors with text descriptions and don't consist of a large number of rooms normally so file size isn't a major consideration for me. Having said that I may reimplement my code to make use of attributes at some point anyway. :) Mike
  8. I'm using xml as a file format for a map editor. My first thought was to use mainly attributes for things like position, item name, etc but after reading a few tutorials I decided to use elements only. No particular reason besides others had recomended this. m-sambo
  9. Alternatively you could make use of the developer area in the later tga spec. Wotsit has a couple of documents that describe this. This would allow you to view your tga's normally in any application but only your application would be able to make sense of the extra embedded info.
  10. m-sambo

    Window managers

    In the past I have used KDE and Fluxbox. At the moment I am using xfce4.
  11. m-sambo

    Compiler Creation

    Quote:Original post by CpMan I would learn a recursive descent parser. It's more intuitive and shows the concepts better, in my opinion. Agreed. I used "Compilers - Principles, Techniques, and Tools" (commonly called the Dragon Book) as a reference at uni when we studied compiler construction and found it to be a great book. Simple compiler construction is not that difficult especailly when broken into steps. First we defined our grammar, then made a tokeniser/scanner and once that was working a recursive descent parser. Mike
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!