glideapps/quicktype

C++: use different integer type

Open

#2.180 aberto em 16 de fev. de 2023

Ver no GitHub
 (2 comments) (2 reactions) (0 assignees)TypeScript (968 forks)batch import
C++customizationgood first issue

Métricas do repositório

Stars
 (10.867 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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.

Guia do colaborador