06.02.2008, 05:50 | #1 |
Участник
|
Issues concerning X++: Caveat: Using the += and -= operators for dates.
Источник: http://blogs.msdn.com/x/archive/2008...for-dates.aspx
============== As you may know, it is possible in X++ to add integers to dates. The semantics are that the integer value is considered a number of days to add or subtract to the date. X++: { Date d; // ... d = d + 7; // Seven days later // ... d = d - 7; // Seven days prior. } The obvious thing to do then is: X++: { Date d; // ... d += 7; // Seven days later // ... d -= 7; // Seven days prior. } X++: { Date d; // ... d += 7; // Seven days later // ... d += -7; // ERROR Seven days prior. } To make matters even worse, the kernel will simply show a dialog box but continue execution with wrong data afterwards. The learning from all this is that if you use these operators for dates, you must make sure the expressions on the right hand side always evaluate to non-negative values. If you cannot guarantee this, use the d = d + expr syntax instead. Источник: http://blogs.msdn.com/x/archive/2008...for-dates.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|