[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Allows inheritence for slur engravers (issue 7437048)
From: |
address@hidden |
Subject: |
Re: Allows inheritence for slur engravers (issue 7437048) |
Date: |
Fri, 1 Mar 2013 18:00:17 +0100 |
On 1 mars 2013, at 17:30, address@hidden wrote:
> On 2013/03/01 14:45:27, mike7 wrote:
>
>> > "doubleSlurs" is not generic but rather specific. I'd use something
>> > like
>> > if (double_property_name_ && to_boolean (get_property
>> > (double_property_name_)))
>> > instead, then we can, if desired, have a separate doublePhrasingSlur
>> > property at some point of time.
>
>> Done. Had to make the check slightly different:
>
>> if ((double_property_name_ != "")
>> && to_boolean (get_property (double_property_name_.c_str ())))
>
> Oh, I'd have made double_property_name_ a const char * const instead
> of a string. That can be 0, and you don't need to c_str on it.
>
>> as GCC complains that there is no operator && for the check you're
> suggesting.
I've always avoided using const char * because I never understood how it works
with memory management.
Given that we are creating a pointer (an array of chars), wouldn't we have to
delete it in the destructor? Furthermore, how does GCC know to allocate the
correct amount of memory for the string? Wouldn't that change depending on the
length of the string?
That's probably the sort of thing you learn in a Freshman CS class...sorry for
the basic question...
Cheers,
MS