glideapps/quicktype

C++: use different integer type

已关闭

#2,180 创建于 2023年2月16日

 (2 条评论) (2 个反应) (0 位负责人)TypeScript (968 个派生)batch import
C++customizationgood first issue

仓库指标

星标
 (10,867 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

When using a JSON Schema to generate C++ code, the generated class always uses int64_t for integer properties. In my other code this frequently leads to compiler warnings when I want to assign an integer property value to a C++ int, because the compiler warns about casts from int64_t to int (because we build with -Wc++11-narrowing and -Wshorten-64-to-32).

Is there a way to specify the C++ data type that should be used for a property? Then I could explicitly change the generated type to int (or short or char) where necessary.

贡献者指南