Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tcc Compiler Update
#1
Is possible update to the last version. How?
#2
Is there an important reason to update?
#3
The main changes between the C89 (also known as ANSI C or C90) and C99 standards of the C programming language are significant and aim to improve functionality, flexibility, and compatibility with other languages. Here is a list of the most important changes:
1. New Data Types:

  • Code:
    Copy      Help
    long long int
    :
    An integer type with at least 64 bits, providing a larger range for integer values.

  • Code:
    Copy      Help
    _Bool
    :
    A boolean type that can take the values 0 (false) or 1 (true). A macro
    Code:
    Copy      Help
    bool
    is defined in
    Code:
    Copy      Help
    <stdbool.h>
    that expands to
    Code:
    Copy      Help
    _Bool
    , along with the macros
    Code:
    Copy      Help
    true
    and
    Code:
    Copy      Help
    false
    .
  • Complex Numbers: The types
    Code:
    Copy      Help
    _Complex
    and
    Code:
    Copy      Help
    _Imaginary
    (optional) are introduced, along with the
    Code:
    Copy      Help
    <complex.h>
    header to support complex number arithmetic.
2. New Keywords:
Five new keywords were added to the language:
  • Code:
    Copy      Help
    inline
    : To suggest to the compiler that it should perform inline expansion of a function to improve performance.
  • Code:
    Copy      Help
    restrict
    : A type qualifier for pointers that indicates that the pointer is the only way to access the pointed object within a certain scope, allowing the compiler to perform optimizations.
  • Code:
    Copy      Help
    _Bool
    : Already mentioned in the data types.
  • Code:
    Copy      Help
    _Complex
    : Already mentioned in the data types.
  • Code:
    Copy      Help
    _Imaginary
    : Already mentioned in the data types.
3. Single-Line Comments:
The C++ style of single-line comments using
Code:
Copy      Help
//
was adopted.
4. Flexible Variable Declarations:
In C89, variable declarations had to appear at the beginning of a block (before any statement). C99 allows declaring variables anywhere within a block, just before they are used for the first time.
5. Variable Length Arrays (VLAs):
C99 allows the declaration of arrays whose size is not a constant at compile time. The size can be determined at runtime. These arrays can be automatic (on the stack) or can be a function parameter.
6.
Code:
Copy      Help
for
Loops with Declaration in Initialization:

C99 allows declaring the control variable directly in the initialization of the
Code:
Copy      Help
for
loop, for example:
Code:
Copy      Help
for (int i = 0; i < 10; i++)
. The scope of this variable is limited to the loop.
7. New Library Functions and Headers:
Several new functions were added to the standard library, along with new headers:
  • Code:
    Copy      Help
    <stdbool.h>
    : Defines macros for the boolean type (
    Code:
    Copy      Help
    bool
    ,
    Code:
    Copy      Help
    true
    ,
    Code:
    Copy      Help
    false
    ).
  • Code:
    Copy      Help
    <stdint.h>
    : Defines integer types with specified widths (such as
    Code:
    Copy      Help
    int32_t
    ,
    Code:
    Copy      Help
    uint64_t
    ).
  • Code:
    Copy      Help
    <complex.h>
    : Provides support for complex numbers.
  • Code:
    Copy      Help
    <tgmath.h>
    : Defines type-generic macros for mathematical functions.
  • Code:
    Copy      Help
    <inttypes.h>
    : Defines functions for formatting fixed-width integers.
  • Code:
    Copy      Help
    <iso646.h>
    : Defines macros for logical and relational operators (such as
    Code:
    Copy      Help
    and
    instead of
    Code:
    Copy      Help
    &&
    ).
  • Code:
    Copy      Help
    <fenv.h>
    : Provides support for controlling the floating-point environment.
8. Improved Preprocessor:
  • Variadic Macros: C99 allows the definition of macros that can take a variable number of arguments, similar to functions with ellipses.

  • Code:
    Copy      Help
    __func__
    Predefined Identifier:
    A predefined identifier that contains the name of the current function as a string.
9. Improved Conversion Rules and Arithmetic:
  • Clearer rules were defined for implicit conversions between arithmetic types.
  • Support for floating-point arithmetic was improved, including better compliance with the IEEE 754 standard.
10. Designated Initializers:
C99 allows initializing specific members of structures and unions by their name, instead of relying on the order of the members. For example:
Code:
Copy      Help
struct { int x; int y; } point = { .y = 10, .x = 5 };
. Designated initialization is also allowed for arrays.
11. Compound Literals:
C99 introduces the possibility of creating values of type struct, union, or array "on the fly" without needing to declare a named variable. For example:
Code:
Copy      Help
(int []){10, 20, 30}
.
12. Defined Behavior for Division and Modulo with Negative Operands:
In C89, the result of division and modulo with negative operands depended on the implementation. C99 specifies that the result of the division is always truncated towards zero, and the sign of the result of the modulo operator is the same as the sign of the first operand.
13. Extended Identifiers:
C99 relaxes the restrictions on the length of identifiers. C89 required compilers to remember the first 31 characters for internal identifiers and only the first 6 characters (case-insensitive) for names with external linkage. C99 increases these limits to 63 characters for internal identifiers and 31 characters (case-sensitive) for names with external linkage.
In summary, C99 introduced many features that made the C language more powerful, flexible, and suitable for a wider range of applications, bringing it closer in some aspects to languages like C++. Although C99 was a significant advancement, other standards such as C11 and C17/C18 were subsequently published, which introduced even more improvements.
#4
The QM TCC version (0.9.25) supports many of C99 features. Maybe the last version supports more, I don't know.

The QM tcc.dll was compiled from TCC source files, with many my modifications (extensions, bug fixes). Too much work to update. The new TCC version has tcclib.dll, but without these modifications it can't be used with the __Tcc class.
#5
Can you modify theĀ __Tcc class to use it?
#6
Too much work too. Studying everything forgotten, testing, debugging, finding workarounds for TCC limitations and bugs...
#7
Ok. I thought it would be simpler.


Forum Jump:


Users browsing this thread: 1 Guest(s)