ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
28 марта
964052 Топик полностью
Zoro (11.12.2019 14:45, просмотров: 709) ответил fk0 на Можно просто енумы генерировать через макрос, который сгенерирует и энум, и inline-функцию принимающую данный enum и возвращающую строку. Проблема потом, как эту функцию вызвать. Например ENUMNAME_tostring(value). Ведь вместо ENUMNAME можно
Я попробовал скомпилировать в опенваткоме - не получилось 
c1.c(48): Warning! W131: No prototype found for function 'MAP1'
c1.c(48): Error! E1011: Symbol 'CASE_STRINGIFY' has not been declared
c1.c(48): Error! E1063: Missing operand
c1.c(48): Error! E1012: Expression is not a function
c1.c(48): Error! E1063: Missing operand
c1.c(48): Error! E1012: Expression is not a function
c1.c(48): Error! E1063: Missing operand
c1.c(48): Error! E1012: Expression is not a function
c1.c(50): Error! E1011: Symbol 'CASE_STRINGIFY' has not been declared
c1.c(50): Error! E1063: Missing operand
c1.c(50): Error! E1012: Expression is not a function
c1.c(50): Error! E1063: Missing operand
c1.c(50): Error! E1012: Expression is not a function
c1.c(50): Error! E1063: Missing operand
c1.c(50): Error! E1012: Expression is not a function
c1.c(58): Error! E1058: Cannot use typedef 'Colors' as a variable
c1.c(58): Error! E1009: Expecting ';' but found 'c'
c1.c(58): Error! E1063: Missing operand
c1.c(59): Error! E1011: Symbol 'c' has not been declared
c1.c(59): Error! E1071: Type of parameter 1 does not agree with previous definition
c1.c(59): Note! I2003: source conversion type is 'int *'
c1.c(59): Note! I2004: target conversion type is 'enum Colors const *'
c1.c(59): Note! I2002: 'Colors_tostr' defined in: c1.c(50)
c1.c(60): Error! E1071: Type of parameter 1 does not agree with previous definition
c1.c(60): Note! I2003: source conversion type is 'int *'
c1.c(60): Note! I2004: target conversion type is 'enum Numbers const *'
c1.c(60): Note! I2002: 'Numbers_tostr' defined in: c1.c(48)