__cplusplus在MSVC中等于199711,是否支持C ++ 11?

时间:2016-05-28 19:26:37

标签: c++ c++11 visual-c++

我想知道我的编译器是否支持C ++ 11,当使用const // create a lift event in LiftEvent let liftEvent = LiftEvent(entity: liftEventEntity, insertIntoManagedObjectContext: managedObjectContext) let dateStr = "05-27-2016" let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "MM-dd-yyyy" let date: NSDate = dateFormatter.dateFromString(dateStr)! liftEvent.date = date liftEvent.liftEventUid = 1 liftEvent.liftUid = 1 liftEvent.formulaUid = 1 liftEvent.maxAmount = 250 print("Added lift ID: \(liftEvent.liftEventUid) lift ID: \(liftEvent.liftUid) weight: \(liftEvent.maxAmount) formula: \(liftEvent.formulaUid) ") saveContext() } func saveContext () { if managedObjectContext.hasChanges { do { try managedObjectContext.save() } catch { // Replace this implementation with code to handle the error appropriately. // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. let nserror = error as NSError NSLog("Unresolved error \(nserror), \(nserror.userInfo)") abort() } } } 来了解C ++版本时,我发现打印__cplusplus

此版本号是否表示编译器支持C ++ 11?
注意:我正在使用199711

1 个答案:

答案 0 :(得分:2)

MSVC存在问题(即缺乏C ++ 11 / C ++ 14支持):

Like this but with sides curved

所以不,就MSVC而言,这个值并不意味着什么具体。一些C ++ 11功能可以完美运行,有些功能会失败。因此,这个C ++ 99-ish值在其中有一定的意义;您最好的选择是检查特定功能(请参阅下面的cxx11tests链接)。

更多信息:

https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l

C++11 on Windows

https://msdn.microsoft.com/pl-pl/library/hh567368.aspx

https://stackoverflow.com/a/27459246/719662

How to Detect if I'm Compiling Code With Visual Studio 2008?