Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • C CodeSamples
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CompilerConstruction
  • CodeSamples
  • Issues
  • #1
Closed
Open
Created May 04, 2020 by Laura-Marie Henning@istlahenn🎯

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?

Assignee
Assign to
Time tracking