fork download
  1. #include <iostream>
  2.  
  3. #define TOTAL_DAYS(day,month,year) (day + month*31 + year*365)
  4.  
  5. namespace checkingDate
  6. {
  7. #define C(i) static const char c##i = __DATE__[i];
  8.  
  9. C(0); C(1); C(2); C(3);
  10. C(4); C(5); C(6); C(7);
  11. C(8); C(9); C(10);
  12.  
  13. static const int current_date = c4 == ' ' ? c5 - '0' : c5 - '0' + 10;
  14.  
  15. static const int current_month = (
  16. c0 == 'J' // Jan Jun Jul
  17. ? (c1 == 'a' ? 1 : (c2 == 'n' ? 6 : 7))
  18. : c0 == 'F' ? 2
  19. : c0 == 'M' // Mar May
  20. ? (c2 == 'r' ? 3 : 5)
  21. : c0 == 'A' // Apr Aug
  22. ? (c1 == 'p' ? 4 : 8)
  23. : c0 == 'S' ? 9
  24. : c0 == 'O' ? 10
  25. : c0 == 'N' ? 11
  26. : 12
  27. );
  28.  
  29. static const int current_year = ((c7 - '0') * 1000) + ((c8 - '0') * 100) + ((c9 - '0') * 10) + (c10 - '0');
  30. static const int totalDays = TOTAL_DAYS(current_date, current_month, current_year);
  31. }
  32.  
  33. # define TODO(day,month,year, str) static_assert(checkingDate::totalDays - TOTAL_DAYS(day,month,year)<30, "old msg");
  34.  
  35. int main()
  36. {
  37. TODO(13, 8, 2015, "...");
  38. }
  39.  
  40.  
  41.  
Success #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty