objective c - What is the assign-enum warning in clang? -
i going through afnetworking
implementation , found this
#pragma clang diagnostic push #pragma clang diagnostic ignored "-wassign-enum" [request sethttpbody:[nsjsonserialization datawithjsonobject:parameters options:0 error:&error]]; #pragma clang diagnostic pop
the assign-enum
warning being turned off, wonder mean.
what warning thrown clang in case?
the warning emitted in absence of clang pragmas is:
integer constant not in range of enumerated type 'nsjsonwritingoptions' (aka 'enum nsjsonwritingoptions')
looking @ declaration of nsjsonwritingoptions
, see there no defined value 0:
enum { nsjsonwritingprettyprinted = (1ul << 0) }; typedef nsuinteger nsjsonwritingoptions;
the docs suggest passing 0, there no option defined nsjsonwritingnooption = 0
, , assigning constant (0) enum type doesn't define 0 possible value.
Comments
Post a Comment