编译一个游戏库时,遇到个奇怪的问题。一个模板函数,形参是按值传入的。编译时实参是内存对齐过的,无法通过,引发类似下面的错误:

error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned

经查,vs2012及之前版本,内存对齐过的数据,是无法按值传入函数中的。 临时fix,将函数传入参数改为引用类型。

一些参考:

http://ofekshilon.com/2010/05/05/stdvector-of-aligned-elements/

http://stackoverflow.com/questions/1281415/error-c2719-val-formal-parameter-with-declspecalign16-wont-be-alig

 

相关文章:

  • 2022-01-27
  • 2022-12-23
  • 2022-02-22
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-13
  • 2022-02-01
  • 2021-06-01
  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
相关资源
相似解决方案