Git Product home page Git Product logo

Comments (3)

satvikc avatar satvikc commented on July 28, 2024

We can use some namespace trick but as far as I know C doesn't support namespace like c++.

from raaz.

satvikc avatar satvikc commented on July 28, 2024

define has global namespace so I dont know how to fix that.

from raaz.

piyush-kurur avatar piyush-kurur commented on July 28, 2024

On Mon, Jul 29, 2013 at 05:02:18AM -0700, satvikc wrote:

I was trying to implement sha256 cportable version and ended into naming conflicts

/usr/bin/gcc returned ExitFailure 1 with error message:
In file included from /tmp/19611.c:2:0:
cbits/raaz/hash/sha256/portable.h:26:14: error: conflicting types for ‘Hash’
typedef Word Hash [ HASH_SIZE ];
^
In file included from /tmp/19611.c:1:0:
cbits/raaz/hash/sha1/portable.h:26:14: note: previous declaration of ‘Hash’
was here
typedef Word Hash [ HASH_SIZE ];
^
cabal: Bad header file: raaz/hash/sha256/portable.h

We should change the naming to be more consistent with the hash it is implementing.

I did not think that the typedefs would clash. Yes we should change
the names. Here are few possibilities

  1. Change it to
typedef uint32_t SHA1Word;
typedef SHA1Word SHA1HASH[ HASH_SIZE ];

This will avoid clash with other typedefs in raaz packages. However,
if some other package depends on raaz and has a separate routine for
sha then there is a possibility of clash. I remember that yesod and
darcs library chashed because there was a sha1 implementation in darcs
which clashed with that of crypto packages used by yesod.

This means prefixing an extra Raaz on to every thing. That kills the
goodness of the typedef.

  1. Use # defines instead of typedefs. This will not clash as it is
    macro substituted. However, I hate this.

We need to discuss this issue in detail.

from raaz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.