typedef "numberType" casted implicitly - question and enhancement proposal
Going through the code from halfBakedCompiler I noticed that in the Lexer there is this convenient definition of numberType
, which let's us define as a single source of truth whether we want doubles and so on.
But throughout the code this is not used all the time, instead doubles are hardcoded, e.g. in the gettok() function inside the default
switch case. It gets converted implicitly a few lines later, though.
I tried to mess a bit with the code but found no solution for replacing e.g. double tmpValue = strtod( alpha, &omega );
adequately. Probably because of my very limited C++ knowledge :).
I came up with the idea of writing another switch-case, that switches for typeid(lex::numberType).name()
. Do you know of any explicit type conversion which let's you convert a char* to a self defined type?