does boost::crc_32_type generate an exception?

Discussion in 'C++' started by A, Oct 2, 2011.

  1. A

    A Guest

    Can this code generate an exception under some circumstances?

    unsigned CRC32(const void *Buffer, unsigned BufferLength)
    {
    boost::crc_32_type result;
    result.process_bytes(Buffer, BufferLength);
    return result.checksum();
    }

    I've seen the example at
    http://www.boost.org/doc/libs/1_37_0/libs/crc/crc_example.cpp
    but that doesn't tell me if it generates exceptions for crc_32_type alone...
    A, Oct 2, 2011
    #1
    1. Advertising

  2. A

    A Guest

    a reply to myself... it seems that crc.hpp doesn't have any throw in it so I
    guess it doesn't generate any exceptions. problem solved :)
    A, Oct 4, 2011
    #2
    1. Advertising

  3. A

    Jorgen Grahn Guest

    On Tue, 2011-10-04, A wrote:
    > a reply to myself...


    OK, but please quote yourself next time to give some context.

    > it seems that crc.hpp doesn't have any throw in it so I
    > guess it doesn't generate any exceptions. problem solved :)


    Have you checked so it doesn't call anything which can throw, either?

    I had a quick look earlier ... their example indeed catches
    exceptions, but only as std::exception and '...'. I get the feeling
    it's due to some overall rule like "never let exception escape
    main()".

    The author should really have documented this. Perhaps he assumed
    everyone knew how CRC calculation are performed ...

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
    Jorgen Grahn, Oct 6, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Latter
    Replies:
    2
    Views:
    2,899
    Julie
    May 17, 2004
  2. Steve Knight
    Replies:
    2
    Views:
    754
    Steve Knight
    Oct 10, 2003
  3. Toby Bradshaw
    Replies:
    6
    Views:
    1,745
    Kai-Uwe Bux
    Jun 2, 2006
  4. Colin Caughie
    Replies:
    1
    Views:
    713
    Shooting
    Aug 29, 2006
  5. Misiu
    Replies:
    3
    Views:
    2,371
    Misiu
    Jan 31, 2007
Loading...

Share This Page