Re: ternary vs double exclamation

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

 



On Sat, 03 Jan 2015 18:54:00 -0500, John de la Garza said:

> It should not be assumed that true will always be 1 as defined in
> include/linux/stddef.h, right?

No, I mean use an actual 'bool' type rather than 'int'.  Consider this from
kernel/softirq.c:

static inline bool lockdep_softirq_start(void)
{
        bool in_hardirq = false;

        if (trace_hardirq_context(current)) {
                in_hardirq = true;
                trace_hardirq_exit();
        }

        lockdep_softirq_enter();

        return in_hardirq;
}

However, this will require actual code analysis to make sure that it's
*really* being used as a boolean, not an int.  In particular, assignments
to/from the variable need to be audited for casting issues (and possibly
the correct rework is to convert *several* variables to bool at once).


Attachment: pgpBjxFwP9ujm.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux