Re:GCC 4.8 Has Automatic Return Type Deduction
by rbanffy on Monday December 10, 2012 @06:03AM
(#4898495)
I'm curious: how popular is it to use syntax that's not available in other compilers and how often do programmers regret the decision?
[ Parent
| on HN ]
Re:GCC 4.8 Has Automatic Return Type Deduction
by mdonohue on Monday December 10, 2012 @06:53AM
(#4898613)
Coverity, maker of c++ static analysis software, and where I used to work, has published a paper about their experience trying to parse customer code. It turns out that 'The language people code in? The strings their compiler accepts'
So yes, it is quite common to use syntax not available in other compilers. Most code is vetted against only one compiler to begin with.
Re:GCC 4.8 Has Automatic Return Type Deduction
by fafner on Monday December 10, 2012 @09:01AM
(#4898980)
Do you use EDG or another frontend? I can only assume that parsing C++ is quite problematic especially with all those compiler extensions and the current transition to C++11.
Re:GCC 4.8 Has Automatic Return Type Deduction
by splinterofchaos on Monday December 10, 2012 @09:33AM
(#4899119)
This particular feature isn't offered by anyone else, so I would not write a program with it and force anyone else who wanted to compile the code to use an unsupported, bleeding edge version of GCC. But I /will/ create a branch of a project or two, using this auto deduction, and send bug reports back if necessary.
I, and many others, have been writing code in Clang and GCC for years that could not be compiled in MSVC. But that code was standard c++11. This is experimental and people should be aware of that while using it.
Re:GCC 4.8 Has Automatic Return Type Deduction
by Someone on Monday December 10, 2012 @05:39PM
(#4901916)
In my (limited) experience, it is not that popular, compared to the use of semantics not available elsewhere (is char signed? Can you cast a void* to int and back without data loss? What happens when you right shift a signed int? etc) and to the extreme use of third party libraries (why the #%$! do I need that GUI library in this json parser? Half an hour later: oh, so it is only for these three typedefs, a few macros, and this convenience debugging function), but it surely does happen.
I also think programmers do regret the decision. Unfortunately, that is unlikely to change, as the programmers regretting the decision almost always are not the ones who wrote the software. It is way rarer for a code base to move compilers within a project/team than for a team wanting to incorporate a third party library into their codebase/compiler.
Re:GCC 4.8 Has Automatic Return Type Deduction
by stingraycharles on Monday December 10, 2012 @06:06AM
(#4898505)
It depends on your environment. If you completely control all the environments your application is deployed in (for example, when you provide a SaaS), it's fairly common.
Re:GCC 4.8 Has Automatic Return Type Deduction
by dagw on Monday December 10, 2012 @09:49AM
(#4899177)
I wonder how many times programmers are even aware that they're using syntax not available in other compilers. I remember the first time I used a non-gcc C compiler and was greatly surprised that things I'd taken for granted and simply assumed was 'C' didn't work.