1 // 2 // labs.cpp 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // Defines labs(), which computes the absolute value of a number. 7 // 8 #include <stdlib.h> 9 10 extern "C" { 11 12 13 14 #pragma function(labs) 15 16 17 18 long __cdecl labs(long const number) 19 { 20 return number >= 0 ? number : -number; 21 } 22 23 24 25 } // extern "C" 26