Visual Studio 2013支持的C99庫(library)



C99已經發布多年,但微軟的Visual C++尚未完整支持C99。我偶然看到VS官方博客上一篇介紹C99庫支持的文章,特翻譯了一下,希望對大家有幫助。水平有限,翻譯不當之處,歡迎指正。


大家好,我是Pat Brenner,Visual C++庫團隊的開發人員。在這篇博文中,我想分享添加到Visual Studio 2013中的 C運行時庫(run-time library)對C99支持的一些信息。

總的來說,我們爲如下頭文件中缺失的函數增加了聲明(declarations)和實現(implementations):math.h,ctype.h,wctype.h,tdio.h, stdlib.h, and wchar.h。我們也新增了一些頭文件,包括complex.h,stdbool.h,fenv.h,和 inttypes.h,並且增加了聲明在它們中的所有函數的實現。此外,我們增加了新的C ++ wrapper headers(ccomplex, cfenv, cinttypes, ctgmath)並且更新了其他的一部分(ccomplex, cctype, clocale, cmath, cstdint, cstdio, cstring, cwchar, and cwctype)。

大部分工作(除了stdbool.h和fenv.h外的所有C頭文件)已經及時在Visual Studio 2013 Preview發佈前完成並且已經可用,但是剩下的(stdbool.h, fenv.h 和 the C++ wrapper headers)將會在Visual Studio 2013 RTM中完成併發布。

更詳細的說,這些是我們增加的聲明和實現,根據聲明它們的頭文件分組:

  • math.h:
    • float_t, double_t, fpclassify, isfinite isinf, isnan, isnormal, signbit
    • HUGE_VALF, HUGE_VALL, INFINITY, NAN, MATH_ERRNO, MATH_ERREXCEPT
    • FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, FP_ILOGB0, FP_ILOGBNAN
    • acosh, acoshf, acoshl, asinh, asinhf, asinhl, atanh, atanhf, atanhl
    • exp2, exp2f, exp2l, expm1, expm1f, expm1l
    • ilogb, ilogbf, ilogbl, logb, logbf, logbl, log1p, log1pf, log1pl, log2, log2f, log2l
    • scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl
    • cbrt, cbrtf, cbrtl, erf, erff, erfl, erfc, erfcf, erfcl
    • lgamma, lgammaf, lgammal, tgamma, tgammaf, tgammal
    • nearbyint, nearbyintf, nearbyintl, nan, nanf, nanl
    • rint, rintf, rintl, lrint, lrintf, lrintl, llrint, llrintf, llrintl
    • round, roundf, roundl, lround, lroundf, lroundl, llround, llroundf, llroundl
    • trunc, truncf, truncl, remainder, remainderf, remainder, remquo, remquof, remquol
    • nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl
    • fdim, fdimf, fdiml, fmax, fmaxf, fmaxl, fmin, fminf, fminl, fma, fmaf, fmal
  • complex.h:
    • cacos, cacosf, cacosl, casin, casinf, casinl, catan, catanf, catanl
    • ccos, ccosf, ccosl, csin, csinf, csinl, ctan, ctanf, ctanl
    • cacosh, cacoshf, cacoshl, casinh, casinhf, casinhl, catanh, catanhf, catanhl
    • ccosh, ccoshf, ccoshl, csinh, csinhf, csinhl, ctanh, ctanhf, ctanhl
    • cexp, cexpf, cexpl, clog, clogf, clogl, cabs, cabsf, cabsl
    • cpow, cpowf, cpowl, csqrt, csqrtf, csqrtl, carg, cargf, cargl
    • cimag, cimagf, cimagl, conj, conjf, conjl, cproj, cprojf, cprojl, creal, crealf, creall
  • fenv.h:
    • fegetenv, fesetenv, feupdateenv, fegetexceptflag, fesetexceptflag
    • feclearexcept, feholdexcept, fetestexcept, feraiseexcept
  • inttypes.h:
    • PRIi8, PRIi16, PRIi32, PRIi64, PRIiMAX, PRIiPTR, PRIiLEAST8, PRIiLEAST16, PRIiLEAST32, PRIiLEAST64, PRIiFAST8, PRIiFAST16, PRIiFAST32, PRIiFAST64
    • PRIo8, PRIo16, PRIo32, PRIo64, PRIoMAX, PRIoPTR, PRIoLEAST8, PRIoLEAST16, PRIoLEAST32, PRIoLEAST64, PRIoFAST8, PRIoFAST16, PRIoFAST32, PRIoFAST64
    • PRIu8, PRIu16, PRIu32, PRIu64, PRIuMAX, PRIuPTR, PRIuLEAST8, PRIuLEAST16, PRIuLEAST32, PRIuLEAST64, PRIuFAST8, PRIuFAST16, PRIuFAST32, PRIuFAST64
    • PRIx8, PRIx16, PRIx32, PRIx64, PRIxMAX, PRIxPTR, PRIxLEAST8, PRIxLEAST16, PRIxLEAST32, PRIxLEAST64, PRIxFAST8, PRIxFAST16, PRIxFAST32, PRIxFAST64
    • PRIX8, PRIX16, PRIX32, PRIX64, PRIXMAX, PRIXPTR, PRIXLEAST8, PRIXLEAST16, PRIXLEAST32, PRIXLEAST64, PRIXFAST8, PRIXFAST16, PRIXFAST32, PRIXFAST64
    • SCNd8, SCNd16, SCNd32, SCNd64, SCNdMAX, SCNdPTR, SCNdLEAST8, SCNdLEAST16, SCNdLEAST32, SCNdLEAST64, SCNdFAST8, SCNdFAST16, SCNdFAST32, SCNdFAST64
    • SCNi8, SCNi16, SCNi32, SCNi64, SCNiMAX, SCNiPTR, SCNiLEAST8, SCNiLEAST16, SCNiLEAST32, SCNiLEAST64, SCNiFAST8, SCNiFAST16, SCNiFAST32, SCNiFAST64
    • SCNo8, SCNo16, SCNo32, SCNo64, SCNoMAX, SCNoPTR, SCNoLEAST8, SCNoLEAST16, SCNoLEAST32, SCNoLEAST64, SCNoFAST8, SCNoFAST16, SCNoFAST32, SCNoFAST64
    • SCNu8, SCNu16, SCNu32, SCNu64, SCNuMAX, SCNuPTR, SCNuLEAST8, SCNuLEAST16, SCNuLEAST32, SCNuLEAST64, SCNuFAST8, SCNuFAST16, SCNuFAST32, SCNuFAST64
    • SCNx8, SCNx16, SCNx32, SCNx64, SCNxMAX, SCNxPTR, SCNxLEAST8, SCNxLEAST16, SCNxLEAST32, SCNxLEAST64, SCNxFAST8, SCNxFAST16, SCNxFAST32, SCNxFAST64
    • SCNX8, SCNX16, SCNX32, SCNX64, SCNXMAX, SCNXPTR, SCNXLEAST8, SCNXLEAST16, SCNXLEAST32, SCNXLEAST64, SCNXFAST8, SCNXFAST16, SCNXFAST32, SCNXFAST64
    • imaxabs, imaxdiv, strtoimax, strtoumax, wcstoimax, wcstoumax
  • ctype.h
    • isblank
  • wctype.h
    • iswblank
  • float.h
    • DECIMAL_DIG, FLT_EVAL_METHOD
  • stdarg.h
    • va_copy
  • stdbool.h
    • bool, true, false, __bool_true_false_are_defined
  • stdio.h
    • vscanf, vfscanf, vsscanf
  • stdlib.h
    • atoll, strtof, strtold, strtoll, strtoull
  • wchar.h
    • vwscanf, vfwscanf, vswscanf, wcstof, wcstold, wcstoll, wcstoull

我們知道這並不是對C99庫函數的完整支持,盡我們的理解,缺少的部分如下:

  • tgmath頭文件缺失,這個頭文件需要C編譯器的支持。
    • 注意,ctgmath 頭文件已經被添加——這是有可能的,因爲這個頭文件不需要tgmath.h頭文件,只需要ccomplex 和 cmath headers頭文件
  • uchar.h偷文件缺失。這來自the C Unicode TR.
  • printf家族中的一些格式說明符尚不支持
  • stdio.h和wcahr.h中的snprintf and snwprintf 函數缺失。

我希望你覺得這些信息有用,我們盡力優先實現我們認爲重要的函數。

Pat Brenner, Visual C++ Libraries Development Team

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章