tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] TinyCC REPL


From: David Mertens
Subject: Re: [Tinycc-devel] TinyCC REPL
Date: Mon, 18 May 2015 06:33:54 -0400

Sergey,

That's a good question. To add the SYM_EXTENDED flag, I took SYM_STRUCT, SYM_FIELD, and SYM_FIRST_ANOM and shifted them down by 1. So, SYM_STRUCT used to be 0x40000000. As to whether or not a 32-bit integer can hold it, isn't that constant equivalent to 2^31? Unless I've miscalculated or lost my mind, I'm pretty sure that fits. It certainly achieves the desired end in code that I've run on my machine, which uses 4 bytes for its integers.

David

On Mon, May 18, 2015 at 6:21 AM, Sergey Korshunoff <address@hidden> wrote:
Hello all
A some question:
========
* push a given symbol on the symbol stack */
ST_FUNC Sym *sym_push(int v, CType *type, int r, int c)
{
    Sym *s, **ps;
    TokenSym *ts;

#ifdef CONFIG_TCC_EXSYMTAB
    v &= ~SYM_EXTENDED;
#endif
    if (local_stack)
        ps = &local_stack;
    else {
#ifdef CONFIG_TCC_EXSYMTAB
        /* Global symbol stack. This is OK for the local symbol stack,
but don't allow
         * this for symbols that are in the extended symbol stack. */
        if (v >= SYM_EXTENDED) {
            tcc_error("Cannot use name '%s' as a global variable, it
is already in the "
                   "extended symbol table.", get_tok_str(v, 0));
        }
#endif
        ps = &global_stack;
    }
========
v is integer and SYM_EXTENDED=0x40000000
When  (v >= SYM_EXTENDED) can be true ?

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel



--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]