[Top][All Lists]

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

Re: [Tinycc-devel] struct bug: identical named struct members

From: Michael Matz
Subject: Re: [Tinycc-devel] struct bug: identical named struct members
Date: Sun, 29 Nov 2020 23:45:47 +0100 (CET)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)


On Sun, 29 Nov 2020, Tyge Løvset wrote:

> Mostly because of the T in tiny c compiler and because no profiling
> shows field lookup to be a problem :)

I have to disagree with this assessment. I only found this bug after
debugging myself.

Sure, I agree the missing check for duplicates is a bug. My reaction was to the question of why there's no hashed mini-symbol table for struct members, not why the check is missing.

When structs have more than e.g. 10 fields, it is easy to add a name that already existed... But my main question is why are enums fields then checked, and what is the principal difference of checking enum fields and struct fields (other than struct creates a new scope during parsing)?

There's really no good reason, except that noone bothered to add the few lines to check for duplicates. I.e.: do it (the check, not the hash table) :)



On Sun, 29 Nov 2020 at 00:16, Michael Matz <matz.tcc@frakked.de> wrote:
      Hello again,

      On Sun, 29 Nov 2020, Michael Matz wrote:

      >>  The only other fast C map I know
      >>  of is khash (https://attractivechaos.github.io/klib),
      however not memory
      >>  efficient, and the codebase is somewhat bigger.
      > I guess there as many map implementations as there are C
      developers :-)

      Though I should say that yours from C99Containers look nice to
      despite the macros-as-template hell in the implementation :-)

      Tinycc-devel mailing list

reply via email to

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