Re: [eigen] eigen3 migration |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] eigen3 migration
- From: Rhys Ulerich <rhys.ulerich@xxxxxxxxx>
- Date: Thu, 14 Apr 2011 08:47:17 -0500
- Cc: ESCANDE Adrien 222264 <adrien.escande@xxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=4sDweEjdkJSX0Dm29OsggefhFZY8FYF7WxmvOTKC6EI=; b=YKzVpVJNAz43G7DTolzo29F1SzwoFL1wSDoNL57gy0paDQ7O2Bv5P1/IVTXb/jgvKK 7iTflOuhxqpxajx9f3Dd3BeHBw/EcVCSojIIZN1YF8NykRUuuHmdF27Im9RsSDH4dx6u GQS4WbvF6yQjzxdK6iCfAu2EkAaZRD9pi67Qo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=pIrFHnjHIXHRjftdQzAr2QEbWL3g5qWj0B45Ym7uH1dq4G7436wjyOpTxwfIiX9GlV X7ESwBggbRf/vZnOCqrHYOaQv41IsNUFKfzOzknkAdqueAsM6UevS1FTMm1sVHT+Pktf 6yTjoslR45/9GGOZaJYOjTX3ZRatxKFjZj0ms=
>> It's pretty annoying that X.h has this #define. But I guess not including
>> X.h is rather difficult.
>>
>> In Eigen3, Success is used as an enum constant to report that a computation
>> was successful.
> That doesn't fix it as any use of the enum will break, like
> if(myComputation() == Success) // this is after including X.h
Would something goofy like
enum ComputationInfo {
#ifndef Success
Success = 0,
#elif Success == 0
# undef Success
Success = 0,
# define Success 0
#else
# error "Success #defined with non-zero value"
#endif
NumericalIssue = 1,
NoConvergence = 2
};
work? This works around any preceding '#define Success 0' macro by
'pushing/popping' its definition. In the end, the token 'Success' will still
be macro expanded but ComputationInfo's enum will contain an entry for the
literal as well. Finally, it loudly breaks if someone uses the wholly
incompatible '#define Success 1'.
- Rhys