TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C++ compiler accepts explicit constructor call

24 pointsby 430gj9jabout 12 years ago

13 comments

MaulingMonkeyabout 12 years ago
While I'm all for improved adherence to standards, the original linked bug report seems like a terrible case to pick a bone about attitudes towards standards compliance with.<p>There are real issues causing real problems which really should be fixed, very much including those related to standards compliance, but this doesn't appear to be one of them. The cure would be worse than the poison: Breaking existing codebases further, making it even harder to update legacy codebases to new toolsets, for an error made -- I'm guessing wildly here instead of verifying -- back in the VS6 era perhaps? That's a lot of code. What do we gain? We... make it slightly harder to accidentally write MSVC specific code. We already have a much, much better and more thorough tool for that: Compiling with a non MSVC compiler. I'd rather see the dev time put towards other issues.<p>As for not hitting C++11 standards compliance straight off the bat, they tried that for C++98 in VS6 and got burned by last minute changes. Yes, it'd be nice if they implemented everything correctly. The bug reports calling out problems with that compliance are very well and good. That said, they aren't billing themselves as feature-complete WRT C++11 yet, and I'd rather take this lackadaisical tempo than see yet another round of implementation mistakes which then need indefinite support.<p>Of course, this is probably colored by the fact that I don't get to use C++11 yet anyways -- out of the environments I'm currently stuck supporting, MSVC is at the bleeding edge of the curve.
andyjohnson0about 12 years ago
Please don't editorialise submission titles.<p>Titling a submission "Visual C++ team's attitude to standards compliance" and pointing it at a bug report for some minor non-conforming behaviour tells us nothing useful about the msvc teams attitude to standards. Neither does the brief response from the team on that page. All it says is that there is an issue that they're not going to fix at the moment. Microsoft have a lot of customers, and those customers have a lot of code that they don't want to suddenly break without a good reason.<p>Do some work. Find or write a useful article investigating the c++ teams attitude to standards compliance and post a link to that. If it compared msvc to other compilers then I'd read it.
CJeffersonabout 12 years ago
Is the implication that other teams are better with standards compliance?<p>Here is a much, much more serious issue. Variable length arrays of C++ types. Totally not in the C++ standard anywhere. Accepted by g++ and clang++, even if I turn on all warnings, and use '-std=c++11', which is supposed to turn off extensions. I have to add -pedantic to finally get a warning.<p>Now, I'm not saying they should break this code, but this is a much, much, much more serious unlabelled breakage of the standard, which is never going to get fixed, and goes back to the start of g++ and clang++.<p><pre><code> struct X {}; int main(int argc, char** argv) { X a[argc]; }</code></pre>
评论 #5631994 未加载
评论 #5632192 未加载
评论 #5631883 未加载
monk_the_dogabout 12 years ago
Just for fun, I checked that code with gcc 4.6 and clang 3.2. gcc gives the error:<p>error: cannot call constructor ‘Thing::Thing’ directly [-fpermissive]<p>clang compiles the code without issuing an error.
ambrop7about 12 years ago
Unless this breaks valid C++ code, I don't see how they need care too much about fixing it, especially since that would break existing code.
评论 #5631696 未加载
430gj9jabout 12 years ago
And also here: <a href="http://connect.microsoft.com/VisualStudio/feedback/details/779916/decltype-and-declval-dont-work-as-expected" rel="nofollow">http://connect.microsoft.com/VisualStudio/feedback/details/7...</a> And again: <a href="http://connect.microsoft.com/VisualStudio/feedback/details/778613/c-compiler-template-type-deduction-with-function-and-overloaded-operators" rel="nofollow">http://connect.microsoft.com/VisualStudio/feedback/details/7...</a>
评论 #5631662 未加载
jfosterabout 12 years ago
Their approach seems reasonable. If they fix this, they will break code that currently works by depending on this. They've not said that they will never fix it, just that they won't for the time being and will reconsider for a future release.
评论 #5631761 未加载
fabricelealabout 12 years ago
C++ noob here. This reminded me of "Obscure C++ Features" [1] (discussion [2]) - the 'Placement new' feature. Basically, we can allocate memory using malloc and <i>then</i> call the constructor on the allocated memory:<p><pre><code> // Must allocate our own memory Test *ptr = (Test *)malloc(sizeof(Test)); // Use placement new new (ptr) Test; // Must call the destructor ourselves ptr-&#62;~Test(); // Must release the memory ourselves free(ptr); </code></pre> My point is: is possible that the explicit constructor call feature is intended to be used in this use case?<p>[1]: <a href="http://madebyevan.com/obscure-cpp-features/" rel="nofollow">http://madebyevan.com/obscure-cpp-features/</a><p>[2]: <a href="https://news.ycombinator.com/item?id=5577631" rel="nofollow">https://news.ycombinator.com/item?id=5577631</a>
frou_dhabout 12 years ago
When I last worked with Windows and would end up on that Microsoft Connect site fairly regularly by Googling, I don't think I ever saw a response that would be satisfactory to the reporter. "Thank for for holding; your call is important to us" or "No", possibly rephrased a few times, was about your lot.
pjmlpabout 12 years ago
How is this different from any other commercial vendor?
hyperblingabout 12 years ago
seems standard. visual studio releases are years behind each other so they're not going to fix anything that's not critical.
cheezabout 12 years ago
In the scope of compliance issues, that is not a huge issue because no C++ developer would write that code.
Piskvorrrabout 12 years ago
In a changing world, you can depend on Microsoft: "Where you want to go today? Meh, as if we care; we have already decided on that."