Displaying 4 results from an estimated 4 matches for "getasintegertrueonsuccess".
2013 Sep 24
2
[LLVMdev] LLD: Returning true on success
...tion in the "error" case. Consider parsing 2 numbers and returning their sum:
>
> if (S1.getAsInteger(16, Result1)) {
> // report failure
> }
> if (S2.getAsInteger(16, Result2)) {
> // report failure
> }
> return Result1 + Result2;
>
> vs.
>
> if (S1.getAsIntegerTrueOnSuccess(16, Result1)) {
> if (S2.getAsIntegerTrueOnSuccess(16, Result2)) {
> return Result1 + Result2;
> } else {
> // report failure
> }
> } else {
> // report failure
> }
Yes. And that is the case where lld was return true for errors.
>
> Of course, in th...
2013 Sep 24
0
[LLVMdev] LLD: Returning true on success
...of sense in this case. The idea is that you increase
indentation in the "error" case. Consider parsing 2 numbers and returning
their sum:
if (S1.getAsInteger(16, Result1)) {
// report failure
}
if (S2.getAsInteger(16, Result2)) {
// report failure
}
return Result1 + Result2;
vs.
if (S1.getAsIntegerTrueOnSuccess(16, Result1)) {
if (S2.getAsIntegerTrueOnSuccess(16, Result2)) {
return Result1 + Result2;
} else {
// report failure
}
} else {
// report failure
}
Of course, in the latter case you would just use ! to avoid gaining
indentation, but still, I think that if most uses of an API will re...
2013 Sep 24
3
[LLVMdev] LLD: Returning true on success
On Sep 24, 2013, at 12:40 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
> On Tue, Sep 24, 2013 at 12:33 PM, Rui Ueyama <ruiu at google.com> wrote:
> Hi LLD developers,
>
> I'm about to make a change to invert the return value of Driver::parse() to return true on success. Currently it returns false on success.
>
> In many other functions, we return true
2013 Sep 25
0
[LLVMdev] LLD: Returning true on success
...on in the "error" case. Consider parsing 2 numbers and
> returning their sum:
>
> if (S1.getAsInteger(16, Result1)) {
> // report failure
> }
> if (S2.getAsInteger(16, Result2)) {
> // report failure
> }
> return Result1 + Result2;
>
> vs.
>
> if (S1.getAsIntegerTrueOnSuccess(16, Result1)) {
> if (S2.getAsIntegerTrueOnSuccess(16, Result2)) {
> return Result1 + Result2;
> } else {
> // report failure
> }
> } else {
> // report failure
> }
>
> Yes. And that is the case where lld was return true for errors.
>
It's not ve...