Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does a program manage type information?

Tags:

c++

types

I was just wondering, how is the type information managed internaly by a c++ program?

eg. float f; needs 32bits of memory. But since all bits are used to save the value, how does the program remember it to be of the type float?

(I know this is quite a noob question...)

like image 882
Fabian Avatar asked Feb 20 '11 21:02

Fabian


People also ask

How is a program managed?

Program management is the process of managing programs mapped to business objectives that improve organizational performance. Program managers oversee and coordinate the various projects and other strategic initiatives throughout an organization.

How program management information system is used within a program?

Program management information systems are used in the process of resource allocation for various projects in the project portfolio, for streamlining and coordinating the entire project portfolio's budget and schedule and for monitoring and controlling projects in the portfolio.


1 Answers

You need to differentiate between static (compile-time) type and dynamic (run-time) type.

Static types are managed by the compiler during compilation and, except for the type-specific semantics embedded in the resulting code, forgotten at run-time.

Dynamic type information is usually held in so-called type-specific "virtual tables", which hold pointers to all virtual functions the type has and what little run-time type information C++ supports. Only polymorphic types (those with at least one virtual function) will have dynamic type information attached.

like image 55
sbi Avatar answered Nov 04 '22 22:11

sbi