source: src/examples/abs.c @ c44e622

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since c44e622 was bd85400, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

remove offsetof keyword, parser 0/1 names as structure fields, update examples to new stdlib, rename algorithms to stdlib, extend stdlib, use correct type for box parameters

  • Property mode set to 100644
File size: 1.4 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// abs.c --
8//
9// Author           : Peter A. Buhr
10// Created On       : Thu Jan 28 18:26:16 2016
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Wed Feb  3 11:14:58 2016
13// Update Count     : 43
14//
15
16#include <fstream>
17#include <stdlib>                                                                               // abs
18
19int main( void ) {
20        ofstream *sout = ofstream_stdout();
21
22        char ch = -65;
23        sout | "char\t\t\t"                                     | ch     | "\tabs " | abs( ch ) | endl;
24        sout | "signed int\t\t"                         | -65    | "\tabs " | abs( -65 ) | endl;
25        sout | "signed long int\t\t"            | -65l   | "\tabs " | abs( -65l ) | endl;
26        sout | "signed long long int\t"         | -65ll  | "\tabs " | abs( -65ll ) | endl;
27        sout | "float\t\t\t"                            | -65.0f | "\tabs " | abs( -65.0f ) | endl;
28        sout | "double\t\t\t"                           | -65.0  | "\tabs " | abs( -65.0 ) | endl;
29        sout | "long double\t\t"                        | -65.0l | "\tabs " | abs( -65.0l ) | endl;
30        sout | "float _Complex\t\t"                     | -65.0F-2.0iF | "\tabs " | abs( -65.0F-2.0iF ) | endl;
31        sout | "double _Complex\t\t"            | -65.0D-2.0iD | "\tabs " | abs( -65.0D-2.0iD ) | endl;
32        sout | "long double _Complex\t"         | -65.0L-2.0iL | "\tabs " | abs( -65.0L-2.0iL ) | endl;
33} // main
34
35// Local Variables: //
36// tab-width: 4 //
37// compile-command: "cfa abs.c" //
38// End: //
Note: See TracBrowser for help on using the repository browser.