https://github.com/root-project/root
Raw File
Tip revision: 50c26a6f0e7220b3ccc2289cafb653fb6ed60fd6 authored by Fons Rademakers on 02 December 2011, 11:40:15 UTC
tag pro version v5-32-00.
Tip revision: 50c26a6
longlong.cxx
/* -*- C++ -*- */
/*************************************************************************
 * Copyright(c) 1995~2005  Masaharu Goto (cint@pcroot.cern.ch)
 *
 * For the licensing terms see the file COPYING
 *
 ************************************************************************/
#include <stdio.h>
#include <iostream>
typedef long long Long64_t;
int main()
{
   Long64_t *w=new Long64_t[5];
   Long64_t x=999741748;
   Long64_t y=162909875;
   w[0]=x<<31;
   w[0]+=y;
   std::cout << "cout:        " << w[0] << std::endl;
   printf("printf ll:   %lld\n", w[0]);
   printf("one less ll: %lld\n", 2146929056215846578LL);
   printf("again ll:    %lld\n", w[0]);
   // warnings are intentional
   printf("printf l:    %ld\n", w[0]);
   printf("one less l:  %ld\n", 2146929056215846578LL);
   printf("again l:     %ld\n", w[0]);
   
   delete []w;
      
  return 0;
}
back to top