• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
IFooBar

Bug in visual c++ 2010 with standard conforming code.

16 posts in this topic

[font="Verdana"][size="2"]Hi, I think there's a possible bug in the c++ compiler that ships with vs 2010. I tried the same code in gcc and it worked fine (unless I was compiling it wrong...). The bug can be reproduced with the following code:
[/size][/font]
[font="Verdana"][size="2"][source lang='cpp']
template <typename T> struct A { void f1(){} void f1() const {} };
template <typename T> struct B : A<T> { using A<T>::f1; };
struct __declspec(dllexport) C : B<int> {};
[/source]
[/size][/font]
[font="Verdana"][size="2"]I'm quite sure the code above is standard conforming. The error you get is error C2487: member of dll interface class may not be declared with dll interface. But, I do not see how that applies in this situation. If you remove the using statement in B then the error goes, and if you remove either overload of the member function of A the error also goes away.[/size][/font]

[font="Verdana"][size="2"]So I guess it's more because of the overloaded member function in A and not B. Also, if you inherit directly from A then the error also disappears.[/size][/font]
0

Share this post


Link to post
Share on other sites
If you use vendor extensions, which includes __declspec, then there's no way that the concept of standard conforming applies.
0

Share this post


Link to post
Share on other sites
Way to miss the point...

The point is that the piece of code should not be problematic AFAIK. Unless Im missing something. Use whatever you need to use to export the code in to a library. MSVC uses declspec dllexport. I did not use declspec when compiling with gcc, obviously, since I was not testing out MSVC's specific extension. Though in this case it might be a bug with the way declspec is implemented. Unless (now here's the point of the post) there's something wrong with the code.
0

Share this post


Link to post
Share on other sites
[quote name='ApochPiQ' timestamp='1314231034' post='4853458']
Why are you asking [i]us[/i]? If you've found a reproducible bug in the VC++ compiler, why not ask Microsoft?
[/quote]Because most people who think they've found a compiler bug are mistaken, and this is a decent place for finding corrections in bad code?
2

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1314232464' post='4853462']
Because most people who think they've found a compiler bug are mistaken, and this is a decent place for finding corrections in bad code?
[/quote]

My point is that [url="http://social.msdn.microsoft.com/Forums/en-US/category/visualc"]this[/url] would probably be a better venue for the question, for three reasons:

[list][*]It offers just as much exposure to expert examination as GDNet, if not more, in case the problem really was flawed code;[*]It offers access to actual Visual C++ developers who can help confirm if this really is a bug;[*]It provides exposure of the issue to those same VC++ developers so they can actually do something about it.[/list]
Nobody has offered even a suggestion that the code itself is to blame, so the logical step in my mind is to escalate the question to someone who can actually help resolve the problem.
0

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1314232464' post='4853462']
[quote name='ApochPiQ' timestamp='1314231034' post='4853458']
Why are you asking [i]us[/i]? If you've found a reproducible bug in the VC++ compiler, why not ask Microsoft?
[/quote]Because most people who think they've found a compiler bug are mistaken, and this is a decent place for finding corrections in bad code?
[/quote]

Exactly... Was looking for someone to just confirm that the code should compile. Rather get some people I trust to confirm it. And this is probably my most trustable forum. And it's pretty interesting behaviour from vc as well.
Just wish some people wouldn't nit pick.
0

Share this post


Link to post
Share on other sites
So sue me for trying to help you get in touch with someone who could give you an authoritative answer [img]http://public.gamedev.net/public/style_emoticons/default/dry.gif[/img]
1

Share this post


Link to post
Share on other sites
[quote name='ApochPiQ' timestamp='1314261672' post='4853559']
So sue me for trying to help you get in touch with someone who could give you an authoritative answer [img]http://public.gamedev.net/public/style_emoticons/default/dry.gif[/img]
[/quote]

Move away from the keyboard and go have some fun.
1

Share this post


Link to post
Share on other sites
[quote][font="Verdana"][size="2"]Hi, I think there's a possible bug in the c++ compiler that ships with vs 2010. I tried the same code in gcc and it worked fine (unless I was compiling it wrong...). The bug can be reproduced with the following code:
[/size][/font]
[font="Verdana"][size="2"]
template <typename T> struct A { void f1(){} void f1() const {} };
template <typename T> struct B : A<T> { using A<T>::f1; };
struct __declspec(dllexport) C : B<int> {};[/size][/font][/quote][font="Verdana"] [/font][font="Verdana"][size="2"]

[code]
template <typename T> struct [/size][/font][font="Verdana"][size="2"]__declspec(dllexport) [/size][/font][font="Verdana"][size="2"]A { void f1(){} void f1() const {} };
template <typename T> struct [/size][/font][font="Verdana"][size="2"]__declspec(dllexport) [/size][/font][font="Verdana"][size="2"]B : A<T> { using A<T>::f1; };
struct __declspec(dllexport) C : B<int> {};
[/code][/size][/font][font="Verdana"][size="2"]I have no clue what happens here, or whether it's a bug or not. The best I can deduce is that A<T>::f1 [url="http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fusing_directive.htm"]is invalid as per spec[/url] and should be A::f1. But that aside:
[/size][/font]
[font="Verdana"][size="2"]
Export everything explicitly. There might be an issue with declspec being applied automatically and somehow breaking something.[/size][/font]
0

Share this post


Link to post
The text editor seems to be completely messed up, it just implodes on quotes, sources and everything.

Put __declspec in front of A and B as well.
0

Share this post


Link to post
Share on other sites
[quote name='IFooBar' timestamp='1314258966' post='4853550']
Just wish some people wouldn't nit pick.
[/quote]
[quote]
Bug in visual c++ 2010 with [b]standard conforming code[/b].
[/quote]
This a moronic claim; calling you on that isn't a nitpick. First off you claim that the code that you used was the same, and then admit that you did in fact use different code on the different compilers. It's a severe logic error that [b]different code[/b] on a different compiler is supposed to tell you how [b]vendor specific[/b] code on another compiler is supposed to work to the extent that you claim that it's a [b]bug in their compiler[/b]. Furthermore, you obviously don't understand what the standard is and is supposed to do. If you don't want to learn, fine, but don't try to claim that your misused terminology isn't to blame for communication problems. If you want discussion to focus on your code, then don't aggressively claim that the first place people should be looking is for standards compliance problems in a compiler implementation. Instead of claiming up front that this code should work and it's a bug in the compiler that it doesn't, simply say the code doesn't work and ask why.

Basically saying "Way to miss the point" when you made it abundantly clear that you thought the problem was standards compliance is just acting like a dick. And then trivializing [b]your [/b]communications errors as other people nitpicking continues that trend. Rate --.
0

Share this post


Link to post
Share on other sites
[url="https://connect.microsoft.com/VisualStudio/feedback/details/685461/c-compiler-bug-in-certain-situation-involving-using-declaration-and-overloaded-base-member-functions"]https://connect.micr...ember-functions[/url]

Issue created on connect, it would have been nice if the OP updated the post to reflect this.
2

Share this post


Link to post
Share on other sites
[quote name='Antheus' timestamp='1314278807' post='4853620']
Put __declspec in front of A and B as well.
[/quote]

Yeah it works then (also just if you put it in front of B), but then it produces compiler errors somewhere else. Only solution right now is to make wrappers.

[quote name='dmail' timestamp='1314285407' post='4853678']
Issue created on connect, it would have been nice if the OP updated the post to reflect this.
[/quote]

Aw common dude. I [b]just[/b] saw that MS acknowledged my feedback!! I was not monitoring that thing 24/7 you know... :/ And I was not going to post here that the issue was posted there before I was sure it was actually something solid. But yeah it turns out it's a bug in VC and it'll be resolved in the next version. It would be interesting to see what was going wrong on the backend though.

Ok, now for that mod dude...

[quote name='SiCrane' timestamp='1314285099' post='4853674']
This a moronic claim; calling you on that isn't a nitpick. First off you claim that the code that you used was the same, and then admit that you did in fact use different code on the different compilers. It's a severe logic error that [b]different code[/b] on a different compiler is supposed to tell you how [b]vendor specific[/b] code on another compiler is supposed to work to the extent that you claim that it's a [b]bug in their compiler[/b]. Furthermore, you obviously don't understand what the standard is and is supposed to do. If you don't want to learn, fine, but don't try to claim that your misused terminology isn't to blame for communication problems. If you want discussion to focus on your code, then don't aggressively claim that the first place people should be looking is for standards compliance problems in a compiler implementation. Instead of claiming up front that this code should work and it's a bug in the compiler that it doesn't, simply say the code doesn't work and ask why.

Basically saying "Way to miss the point" when you made it abundantly clear that you thought the problem was standards compliance is just acting like a dick. And then trivializing [b]your [/b]communications errors as other people nitpicking continues that trend. Rate --.
[/quote]


Wow that's amazing, I love how you take15 words from a 200 word post of mine and choose to highlight 5 words that completely work against me. Completely! Impressive. Though, the other part of the title which you conveniently ignore reads [b]bug in visual studio 2010[/b]. Which also makes it [b]abundantly clear[/b] that I thought the problem was in MSVC, not in the code, but since I wasn't a 100% sure, I posted here.

Claim? Admit? What? Are we in a court room? I'm not claiming anything (aggressively or otherwise). I was just asking if the code is supposed to produce an error or not. I assumed people would know that you create libraries in different ways depending on the platform - maybe because I don't assume people are morons (as you so eloquently put it). So when I said standard conforming code I was implicitly referring to the actual c++ code (which declspec is [b]not[/b] a part of) and wondering if there was anything wrong with it.

I can tell from your tone that you're one of those guys who thinks they're always right, but chill out will ya, and do something productive instead of chucking around insults. If you don't mind, I'm going skip the part where I provide a retort to you calling me a dick and a moron since someone has to keep things civil.

-3

Share this post


Link to post
Share on other sites
Chill. ;)

There is enough meaningful negativity about Windows and how things work (or don't) with MS tools. In fairness you must admit that your original post could have come across as one of those.
1

Share this post


Link to post
Share on other sites
[quote name='IFooBar' timestamp='1314312173' post='4853855']
Aw common dude. I [b]just[/b] saw that MS acknowledged my feedback!! I was not monitoring that thing 24/7 you know... :/ And I was not going to post here that the issue was posted there before I was sure it was actually something solid. But yeah it turns out it's a bug in VC and it'll be resolved in the next version. It would be interesting to see what was going wrong on the backend though.
[/quote]

FYI the bug report had not been acknowledged as a bug when I added that link. What I am saying is that people suggested to file a bug report and instead of wasting peoples time (as the issue was being looked at by MS) then to state this is what you did. By linking to that report if also allows potential future viewers to see what the outcome was.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0