News for hackers. Stuff that matters.
Re:Rejuvenating the Microsoft C/C++ Compiler by exDM69 on Friday September 25, 2015 @07:23AM (#10277485)
This is excellent news. MSVC is a big pain in the ass for me, as I tend to write C code (not ++ usually) and Microsoft's C compiler is the one with the worst support for language level features (out of widely used compilers). E.g. having to move variables to beginning of block (c89 style) is just miserable. A popular option is to compile C code as C++ inside an "extern C" block to stop name mangling, but this isn't too clean either.

I'd also like to have compatibility of some language extension features, such as built-in functions and attributes. In particular, CPU-agnostic intrinsics for common instructions like atomics, popcount or count leading zeros as well SIMD arithmetic would be great.

My favorite C language extension is SIMD vector arithmetic with infix operators. You can get really pretty and portable (!) vector math code written in Clang and GCC using vector extensions, but again, it's not available in MSVC.

For most of my current projects, I have no intent of supporting the (current) Microsoft C compiler. It's not worth the effort.

Re:Rejuvenating the Microsoft C/C++ Compiler by to3m on Friday September 25, 2015 @08:35AM (#10277761)
VC++ has historically been the odd man out, but it's improved greatly in the last couple of versions. Certainly, VS2013 has reasonable support for a lot of C99 code. My C99 code builds on clang (OS X), gcc (Linux), and VC++ (Windows). Maybe I need to get more adventurous, but what I see as the key improvements (designated initializers, compound literals, declarations (nearly) anywhere) are now in place.

Main omissions I've noticed: printf isn't quite the same (no 'z' modifier, the 'n' forms are noticeably inferior), no VLAs.Also, standard library isn't POSIX (which is not an omission but a lot of C code assumes POSIX so you'll probably end up having to deal with this).

I'm surprised you mention intrinsics, since VC++ has a wide selection - https://msdn.microsoft.com/en-us/library/hh977022.aspx - and I'd expect, though without proof, the differences between many of those available on both VC++ and gcc/clang to be something you could work around with #define or, failing that, a small inline function (and cross your fingers).

Aside from VLAs, which is annoying, you can work around most of these with wrapper functions and #defines. So I've been pleased enough with the latest VC++. As a long time programmer for multiple platforms, I can put up with a certain amount of deprivation, and having to put in a bit of effort doesn't bother me (all that much). But I've noticed a tendency for people to sometimes assume that "multiple platforms" means "ten different types of gcc+POSIX+fork+pthreads". I'm sure that even shiny new C99-friendly VC++ won't make them happy.

Re:Rejuvenating the Microsoft C/C++ Compiler by stinos on Friday September 25, 2015 @10:33AM (#10278360)
"multiple platforms" means "ten different types of gcc+POSIX+fork+pthreads"

This. Unfortunate, but some even seem to think C99 support automatically means POSIX and then start complaining a platform isn't compatible if it doesn't handle what they thought was portable code..

Re:Rejuvenating the Microsoft C/C++ Compiler by uxcn on Friday September 25, 2015 @11:58AM (#10278866)
Why is it bad to expect a portable operating system interface? Almost all languages have been doing this over the last decade (C, C++, Java, Go, Python, Ruby, PHP, etc...).
Re:Rejuvenating the Microsoft C/C++ Compiler by corysama on Friday September 25, 2015 @12:12PM (#10278958)
I once had the pleasure of writing a game engine that ran on Windows, Xbox, Xbox360, PS2, PS3, GameCube and the Wii. The 3 Microsoft systems shared some very basic Win32-style system API, but the other 4 were completely unique. When I see people talk about "cross platform" code only to find they mean "Linux and OSX!" I chuckle a little.
Re:Rejuvenating the Microsoft C/C++ Compiler by uxcn on Friday September 25, 2015 @12:27PM (#10279059)
I can only guess what the portable code for PS3 looked like :).
Re:Rejuvenating the Microsoft C/C++ Compiler by corysama on Friday September 25, 2015 @12:58PM (#10279270)
Re:Rejuvenating the Microsoft C/C++ Compiler by nickpsecurity on Friday September 25, 2015 @07:45PM (#10281417)
That was some funny stuff and enlightening. I remember having the PS2 experience myself when studying its architecture: so many individual processors stitched together it was like re-inventing 60-80's computing experience lol. That said, I thought it was cool that they threw in some scratchpad. It's better than cache in many ways and so underutlized in special-purpose, performance designs. Helps with real-time, too, as it's predictable. PS2's mainly just helped with I/O hacks IIRC correctly, though.

Also interesting to contrast your description of PS3 with Naughty Dog comments. Seems like they got a lot more out of them but had to work hard to do it. Curious, there were products that auto-synthesized code for SPU's like RapidMind. I had planned on trying them had I used PS3's for acceleration. Did you or anyone in that industry try those tools to see if they delivered similar performance over hand-coded algorithms in gaming workloads?

http://www.theregister.co.uk/Print/2007/05/08/rapidmind_two/

Re:Rejuvenating the Microsoft C/C++ Compiler by corysama on Saturday September 26, 2015 @02:31AM (#10282326)
The big difference between the project I was on vs Naughty Dog was that ND was 100% committed to the PS3 exclusively and eternally. If you know you can't escape then you are motivated to put in the effort to make it as good a fate as possible. The PS3 rewarded effort, but only on a very steep curve...

Meanwhile, my team was multiplatform. That meant most people could hide in the easy spaces on the PC or maybe the 360. We had a small group of Russians and Europeans who enjoyed the challenge of hand-optimizing the SPU. They would not have tolerated synthesized code ;)

Re:Rejuvenating the Microsoft C/C++ Compiler by nickpsecurity on Saturday September 26, 2015 @02:17PM (#10283908)
That makes sense. The Russian angle, too: prior experience showed thdm to bd good at programming and optimization. One told me it's because access to good hardware was limited for many and so people got the most out of what they had. He said some even coded and debugged algorithms on paper before going to Internet cafes.

I'd probably try to get more in OSS projects but they can be a rowdy bunch. Gotta have manager or leader that can keep the egos and nationalism in check. ;)

Re:Rejuvenating the Microsoft C/C++ Compiler by srott on Friday September 25, 2015 @01:15PM (#10279366)
you mean half of code compiled with __cdecl, other half __stdcall, some calls as pascal... oh, that's cute..

and 32/64bit..

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @12:27PM (#10279060)
Because C and C++ never really had one.

UNIX was seen as the C runtime. When the standard came ANSI C adopted what was considered the minimum portable bits one could use in non UNIX systems.

Then came POSIX, which isn't as portable as many think. It also enjoys some of the UB and implementation specific behavior of the C world.

C++ while trying to cater to C developers adopted the same attitude.

Thankfully the C++ committee is changing that with C++17.

Re:Rejuvenating the Microsoft C/C++ Compiler by uxcn on Friday September 25, 2015 @04:58PM (#10280640)
It's a bit disappointing C seems to be getting left behind in some areas. It's simpler to compile, which in theory should mean that it's more portable.
Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Saturday September 26, 2015 @02:06AM (#10282278)
No it is not.

http://blog.llvm.org/2011/05/what-every-c-programmer-should-...

http://blog.llvm.org/2011/05/what-every-c-programmer-should-...

http://blog.llvm.org/2011/05/what-every-c-programmer-should-...

Many equate "C == what my compiler does", but just like any standardized technology with holes open to implementers to decide upon, portability isn't as people think.

Re:Rejuvenating the Microsoft C/C++ Compiler by uxcn on Saturday September 26, 2015 @01:35PM (#10283725)
I read Chris Lattner's posts. There are definitely things the standards don't specify that people take for granted (twos-complement for example). C is still an order of magnitude easier to parse than C++ though (especially modern). In theory, implementing and maintaining a compiler for it for a platform should be simpler.

Implementing an effective compiler is another concern entirely, but I would still argue that there tend to be more incompatibilities between C++ implementations than C.

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Saturday September 26, 2015 @02:57PM (#10284058)
Yes, parsing is way harder because C++ requires the context aware grammar.

However many C++ incompatibilities are actually caused by C compatibility and the goal of having higher constructs that are copy paste compatible with C but with additional semantics, e.g. structs.

So in both cases, to achieve your portability goal the languages would have to be fully specified.

Re:Rejuvenating the Microsoft C/C++ Compiler by uxcn on Saturday September 26, 2015 @05:26PM (#10284474)
C and C++ are admittedly different languages, but I would think more than less of the code for compiling both languages should be the same. I personally can't see how one language would impede the other.

As a C/C++ user, I'm honestly still not sure why a number of C features have yet to be formalized in C++ (e.g. restrict).

Re:Rejuvenating the Microsoft C/C++ Compiler by emddudley on Friday September 25, 2015 @12:35PM (#10279125)
> Thankfully the C++ committee is changing that with C++17.

Which C++17 feature are you referring to? Modules?

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @01:14PM (#10279355)
The work being done by the SG

https://isocpp.org/std/status

Filesystems, networking, concurrency, ....

Sadly databases died out apparently.

Re:Rejuvenating the Microsoft C/C++ Compiler by nickpsecurity on Friday September 25, 2015 @07:47PM (#10281426)
Looks like they're doing what they should've done some time ago and what helped many competing languages get ahead. Between that and recent standards, C++ programming might get really interesting again. Even I might take a stab at it eventually.
Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Saturday September 26, 2015 @02:19AM (#10282307)
Even though I hardly use it at work (JVM/.NET), it was my to go to language after Turbo Pascal. So I still enjoy following and dabbling with it.

Some of the issues C++ had were:

- C compilers were still catching up with ANSI C89 and it was a mess

- C++ being in the process of becoming standardise was even worse. It was quite hard to find out what were the working common features between compiler vendors, specially in terms of semantics

- The C culture that prevented many nice frameworks to succeed, because they were too high level, hence why MFC is such a thin wrapper over Win32.

- Lack of standard ABI in an age people only shared binary libraries.

C++14 and C++17 look really nice, but I doubt C++ will recover its place at the enterprise, beyond performance critical libraries/modules.

Re:Rejuvenating the Microsoft C/C++ Compiler by stinos on Friday September 25, 2015 @12:07PM (#10278922)
Expecting it isn't bad, blindly assuming POSIX is available everywhere is bad, as in calling your code cross-platform because it uses just C99 and POSIX for instance
Re:Rejuvenating the Microsoft C/C++ Compiler by uxcn on Friday September 25, 2015 @12:20PM (#10279020)
The majority of the time it's a safe assumption though, so I'm not sure developers can really be considered to blame.

The reality is, without it, developing software for a platform takes more effort which I think is one of the reasons languages have taken on the initiative of building portable interfaces. Even C11 has added threads.h.

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @08:41AM (#10277771)
> But I've noticed a tendency for people to sometimes assume that "multiple platforms" means "ten different types of gcc+POSIX+fork+pthreads".

Having done multiple platform C development across Aix, HP-UX, Solaris, GNU/Linux and Windows in the first .com wave, as well as, having some embedded knowledge, it is always interesting that for some people only gcc and now clang exist.

As for C99, Microsoft is pretty clear that are only supporting what is required by the C++ standard.

Re:Rejuvenating the Microsoft C/C++ Compiler by ch_123 on Friday September 25, 2015 @08:58AM (#10277857)
I believe they have started explicitly targeting C99 support in more recent versions in order to make it easier to port C code developed against gcc or clang.

Here's an older article - http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-librar...

(I've seen more recent ones, but I can't find an example to hand)

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @02:35PM (#10279861)
Given that the video was already a bit old, this is the latest official statement I could find, from 29 Apr 2015.

http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17...

"Q. What about the C99 Core Language, or the C11 Core Language and Standard Library?

A. Our top priority is C++ conformance. We've implemented the C99 Standard Library because C++11 incorporated it by reference. C++ (up to the current Working Paper) hasn't incorporated the C99 Core Language in its entirety (only a handful of features, listed above), nor is it ever likely to. It may incorporate the C11 Standard Library at some point in the future, but that hasn't happened yet.

In VS 2013, the compiler team implemented some C99 Core Language features in C mode (e.g. designated initializers, see MSDN for the full list), in order to support some popular libraries. "

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @09:25AM (#10277988)
No they were pretty clear that it is only what is required by C++ standard, and some high profile customers.

There was a C9 interview about it, need to search for it.

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @02:57PM (#10279985)
Could not find the interview video, but this was another one I remembered have watched:

https://channel9.msdn.com/Events/Visual-Studio/Launch-2013/V...

Starting at 00:18:40, note the "not an intent to conform to C99/C11".

FFMpeg was one of the customers

Re:Rejuvenating the Microsoft C/C++ Compiler by eatonphil on Friday September 25, 2015 @10:37AM (#10278384)
Out of curiosity, who are MSVCs high profile customers?
Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @11:49AM (#10278806)
They didn't mentioned on the interview.

If I recall correctly it was at a Visual Studio event last year, on those floor interviews they publish with the teams on C9.

Re:Rejuvenating the Microsoft C/C++ Compiler by cwyers on Friday September 25, 2015 @11:57AM (#10278862)
Adobe is almost certainly one:

https://helpx.adobe.com/creative-suite/kb/microsoft-visual-c...

There's probably quite a few internal-only users of Visual C++ too.

EDIT: Well, they're a high-profile user of Visual C++, I have no idea if they require C99 support but they ship a Mac version so it's possible.

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @02:58PM (#10279988)
One of them was FFMpeg, from the video I digged out.
Re:Rejuvenating the Microsoft C/C++ Compiler by AnimalMuppet on Friday September 25, 2015 @12:43PM (#10279187)
When I was in that situation (maybe ten years ago), we ran gcc on Aix, HP-UX, Solaris, Linux, Tru64, SGI, and maybe a couple of others. Then of course there was Windows, which used the Microsoft compiler. But using only two compilers made the ten or so platforms easier to deal with. (There still was a bunch of code that was "#ifdef SGI/#else/#endif", and similarly for other platforms, but at least the compilers behaved the same.)
Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @01:18PM (#10279378)
We had to use the vendor compilers, so no fun.

This was the only time period I used C instead of C++ at work.

However I do confess, the situation for C++ support was even worse, so although I am not fan of C, the decision made sense from business point of view.

Re:Rejuvenating the Microsoft C/C++ Compiler by AnimalMuppet on Friday September 25, 2015 @01:29PM (#10279446)
How long ago was your experience? Was gcc an option at that time? Or did management require you to use the vendor compiler?

What we did was, we used the vendor compilers to compile gcc for a platform (or maybe used gcc to cross-compile itself, I forget). Then we used that gcc to compile gcc for that platform. Then we used the new gcc to compile gcc for that platform, and made sure that it was the same as the previous gcc. This wasn't easy - we had one guy that this is pretty much all he did for months. But it got us to a place where we were free from the vendor compilers.

Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @01:57PM (#10279618)
> How long ago was your experience?

It was back in the first .com wave, so 1999 - 2002.

> Was gcc an option at that time? Or did management require you to use the vendor compiler?

Customers did. Our software needed to integrate with their existing toolchains.

At least for our customers gcc was not a serious compiler, given the license and being that funny open source thingy.

Re:Rejuvenating the Microsoft C/C++ Compiler by StephanTLavavej on Friday September 25, 2015 @11:33AM (#10278704)
FYI, C99 printf including 'z' for size_t was fully implemented in VS 2015.
Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Friday September 25, 2015 @12:21PM (#10279023)
Most likely you are not allowed to comment on it, but has the official position from the last C9 VS team interviews changed?
Re:Rejuvenating the Microsoft C/C++ Compiler by StephanTLavavej on Friday September 25, 2015 @09:05PM (#10281672)
I believe we're hoping that Clang/C2 will satisfy those who want to build C99 TUs on Windows. Personally, I have absolutely no interest in C99 (I wasted a year and a half of my life learning C before C++).
Re:Rejuvenating the Microsoft C/C++ Compiler by pjmlp on Saturday September 26, 2015 @02:28AM (#10282322)
Thanks for replying. I had a similar experience back in the MS-DOS days still, and share the same opinion.

Turbo Pascal -> C (meh) -> C++ (great back in business!)

Even though I mostly do JVM and .NET nowadays, still enjoy playing with C++ on the side, specially for mobile OS coding.

I see dropping C support on Windows as a means to force developers to migrate to more secure languages, but of course Microsoft should do what makes business sense.

Re:Rejuvenating the Microsoft C/C++ Compiler by spongo2 on Friday September 25, 2015 @10:51PM (#10281907)
correct.
Re:Rejuvenating the Microsoft C/C++ Compiler by to3m on Friday September 25, 2015 @07:19PM (#10281316)
Thanks for the note. Switching to VS2015 just worked its way up my to do list.
Re:Rejuvenating the Microsoft C/C++ Compiler by StephanTLavavej on Friday September 25, 2015 @09:07PM (#10281684)
Re:Rejuvenating the Microsoft C/C++ Compiler by stinos on Friday September 25, 2015 @10:30AM (#10278347)
E.g. having to move variables to beginning of block (c89 style) is just miserable

Since VS2013 there has been partial C99 support and as such this is not needed anymore, finally.

Re:Rejuvenating the Microsoft C/C++ Compiler by valarauca1 on Friday September 25, 2015 @07:42AM (#10277553)
>My favorite C language extension is SIMD vector arithmetic with infix operators. You can get really pretty and portable (!) vector math code written in Clang and GCC using vector extensions, but again, it's not available in MSVC.

Forgive me as I might be wrong but aren't system intrinsics the same in each compiler? I was under this impression as I wrote a lot of SSE2/3 C99 code for the GCC using MSVC++ documentation it compiles/runs without an issue. (This also before finding the MMX/SSE/AVX docs that intel has which are beautiful).

I mean the function/variable type names (for x86_64 at least) are the same for Clang/ICC/GCC/MSVC.

Re:Rejuvenating the Microsoft C/C++ Compiler by phkahler on Friday September 25, 2015 @10:00AM (#10278152)
>> Forgive me as I might be wrong but aren't system intrinsics the same in each compiler?

>> I mean the function/variable type names (for x86_64 at least) are the same for Clang/ICC/GCC/MSVC.

Yes, all those compilers support the same names for x86_64. Then a different set for ARM NEON, and a different set for PPC AltiVec. What GCC has done is implement another set of names that can be used across all those hardware architectures. To clarify the difference, you can choose - do you want to move your code between different compilers, or different hardware but always with GCC.

Re:Rejuvenating the Microsoft C/C++ Compiler by yoklov on Friday September 25, 2015 @09:08AM (#10277899)
Honestly the non-intrinsic SIMD code is a mixed bag. I like the portability compared to intrinsics, but it encourages SIMD antipatterns like using a vector register to store one object (as opposed to using it to step over loops 4/8/16 at a time). It's also less reliable about generating good code IME.
Re:Rejuvenating the Microsoft C/C++ Compiler by userbinator on Friday September 25, 2015 @08:40AM (#10277769)
E.g. having to move variables to beginning of block (c89 style) is just miserable.

I actually find this style clearer since all the variables are accounted for at the beginning and it helps when looking for them (and associated comments, if any). You can always open a new block when you need a new set of variables. Do you happen to have started with a more dynamic language which didn't require variables to be declared? That was the case I've seen with most other programmers who preferred creating (often very many) variables only at the point of use.

Re:Rejuvenating the Microsoft C/C++ Compiler by GFK_of_xmaspast on Friday September 25, 2015 @09:57AM (#10278128)
I learned c in the c89 days as my 3rd or 4th language (after modula-2 and pascal and maybe fortran) and now, in 2015, I can confirm that beginning-of-block variables are in fact just miserable.
Re:Rejuvenating the Microsoft C/C++ Compiler by bluecalm on Friday September 25, 2015 @10:55AM (#10278517)
I share the view that it's more clear to have all the variables declared at the top. The only exception I am making in my code are loop variables but the point doesn't apply to those as you want the smallest scope possible so declaring them at the top of the block where the loop is located is just inferior.

I find the style easier to read as you can instantly see what variables will be operated on, what arrays filled etc. It's also quite important for me to know how much stuff is allocated in given block so I don't blow out the stack and having all the things at the top makes it easier to think about. It's probably about being used to it but I found the code with mixed declarations and logic to be inelegant and more difficult to understand.

Re:Rejuvenating the Microsoft C/C++ Compiler by Peaker on Friday September 25, 2015 @12:28PM (#10279074)
You're forced to declare them before they have a sensible value to use.

You're exposing your code to unnecessary bugs where you user the variable prematurely.

Variables tend to be declared further from their use, making it harder to find them and see their types.

The stack size argument is wrong, because variables aren't necessarily on the stack, and non variable allocations may be put on the stack (i.e it's neither necessary nor sufficient to predict stack use).

You're discouraged from creating intermediate variables that aid readability.

You're discouraged from declaring your variables const, losing extra safety.

All in all, it's a terrible way to code.

Re:Rejuvenating the Microsoft C/C++ Compiler by bluecalm on Friday September 25, 2015 @03:01PM (#10280012)
>>You're forced to declare them before they have a sensible value to use.

As I said I like it because I like seeing what will be operated on when I start reading a block. I don't need to initialize them just yet.

>>You're exposing your code to unnecessary bugs where you user the variable prematurely.

The compiler warns when you use uninitialized variable. Just don't initialize them to random things, leave them uninitialized.

>>Variables tend to be declared further from their use, making it harder to find them and see their types.

I mean, I can see how that could be a problem but I don't have blocks bigger than one screen so I can alway see them anyway. I like short functions/blocks. It's also way easier to visualize what is happening if I allocate memory in my brain for the variables so to speak.

>>The stack size argument is wrong, because variables aren't necessarily on the stack, and non variable allocations may be put on the stack (i.e it's neither necessary nor sufficient to predict stack use).

It might be technically wrong but the real problems are arrays as they are the only thing which could blow out the stack (especially in recursive functions) so yeah, I don't see it as a problem although I imagine it could be for some.

>>You're discouraged from creating intermediate variables that aid readability.

I am not discouraged. Again, maybe it sounds super strange to you but I am actually discouraged if I had to put them in the middle of the code logic as I find it ugly and I need to readjust my picture of what is going on once I encounter some new variable I didn't know is going to be there when glancing at the block.

>>You're discouraged from declaring your variables const, losing extra safety.

I think const is as good as useless in C when it comes to declaring variables. I don't think it gives any extra safety it's just more typing and additional pain.

>>All in all, it's a terrible way to code.

I don't know. I think you lost the perspective. One way or the other it won't be a big difference and a lot of good code is written in the old/traditional style. You may think it's worse but it is not terrible.

Re:Rejuvenating the Microsoft C/C++ Compiler by wnissen on Friday September 25, 2015 @01:39PM (#10279512)
All excellent points, and I would add that it changes the semantics of the code when it comes to threading, which is will be a more and more major issue going forward. If the variable is declared outside the parallel section (such as a for loop), it's assumed that it is shared (and therefore synchronized), while if it's declared inside it is clearly private to each thread and no synchronization is required.
Re:Rejuvenating the Microsoft C/C++ Compiler by bluecalm on Friday September 25, 2015 @03:02PM (#10280017)
We are talking about top of the block. When you are creating a parallel section you have a new block/scope there so that argument doesn't apply. Both styles are the same when it comes to scope of the variables.
Re:Rejuvenating the Microsoft C/C++ Compiler by pcwalton on Friday September 25, 2015 @12:26PM (#10279051)
> It's also quite important for me to know how much stuff is allocated in given block so I don't blow out the stack and having all the things at the top makes it easier to think about.

With modern compiler backends you haven't been able to reliably reason about stack usage by looking at the number of local variables for quite some time. Even ignoring IR-level optimizations and register allocation, modern compilers will do coloring on the stack slots that remain, meaning that the number of stack locations you end up using is flow-sensitive (and thus moving to the top is actually technically obscuring things).

Re:Rejuvenating the Microsoft C/C++ Compiler by aninteger on Friday September 25, 2015 @11:03AM (#10278552)
I just wanted to say that I agree with you, but that's because of age. These days I do more C#, but I still use this style even in that language although this is becoming less frequent as I replace code and use C#'s "var" declaration and assignment keyword.
Re:Rejuvenating the Microsoft C/C++ Compiler by autoreleasepool on Friday September 25, 2015 @09:51AM (#10278099)
I believe creating variables at the point of use was retroactively inherited from C++ in C99. It can be useful feature when not abused.
Re:Rejuvenating the Microsoft C/C++ Compiler by Peaker on Friday September 25, 2015 @12:24PM (#10279038)
What would be considered abuse here?

Beginning of block variables are generally always worse than as late as possible variables.

Re:Rejuvenating the Microsoft C/C++ Compiler by jlarocco on Friday September 25, 2015 @12:50PM (#10279229)
Unfortunately, Microsoft has stated publicly on a few occasions that they have no plans of supporting C99 or C11 outside of what they have to implement anyway for new versions of C++.

The article isn't very clear, but I would guess backward compatibility is going to trump adding new features as far as the C compiler goes.

I wouldn't mind getting proved wrong, but the article mentions a lot of C++ features they're working on, and doesn't mention an C features they're working on.

Re:Rejuvenating the Microsoft C/C++ Compiler by spongo2 on Friday September 25, 2015 @10:52PM (#10281911)
we are targeting C99 via the new Clang / C2 hybrid compiler. We demoed it on stage at CppCon this week.
Re:Rejuvenating the Microsoft C/C++ Compiler by jlarocco on Tuesday September 29, 2015 @12:14AM (#10294652)
Well, I guess I stand corrected!

Microsoft keeps surprising me lately!

Re:Rejuvenating the Microsoft C/C++ Compiler by Ono-Sendai on Friday September 25, 2015 @07:40AM (#10277548)
MSVC has those things. __popcnt64 __mm_add_ps etc.. or do you mean something else?