C++ variable types limits

前端 未结 4 648
不思量自难忘°
不思量自难忘° 2020-12-10 04:00

here is a quite simple question(I think), is there a STL library method that provides the limit of a variable type (e.g integer) ?

4条回答
  •  失恋的感觉
    2020-12-10 04:42

    (related to C, but I think this also applies for C++)

    You can also try "enquire", which is a script which can re-create limits.h for your compiler. A quote from the projetc's home page:

    This is a program that determines many properties of the C compiler and machine that it is run on, such as minimum and maximum [un]signed char/int/long, many properties of float/ [long] double, and so on.

    As an option it produces the ANSI C float.h and limits.h files.

    As a further option, it even checks that the compiler reads the header files correctly.

    It is a good test-case for compilers, since it exercises them with many limiting values, such as the minimum and maximum floating-point numbers.

提交回复
热议问题