This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix compilation error in i2c.cxx


>>>>> "Ian" == Ian Campbell <icampbell@arcom.com> writes:

    Ian> On Fri, 2005-07-15 at 14:44 +0100, Bart Veer wrote:
    >> No. The actual bug is that the const should not be present. The
    >> cyg_i2c_bus* argument was originally const but this was later
    >> dropped, allowing the init fn to tweak the bus structure if
    >> necessary. The compiler version I was using at the time did not
    >> show this.

    Ian> That's what I originally had -- but isn't NULL defined to be
    Ian> NULL no matter what the pointer type is, so there is no need
    Ian> to manually construct one for each particular pointer?

That is true in C but not necessarily in C++. I don't remember all the
details offhand, but NULL involves casting to void* which is not
always acceptable. I wanted to use a prioritized static constructor in
the I2C code, so it was easier to write the lot in C++.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]