// Compile with g++ -std=c++11 -Wconversion #include typedef std::int32_t F77_INT; typedef std::int64_t octave_idx_type; void foo_32 (const F77_INT *) { } void foo_64 (const octave_idx_type *) { } void bar_32 (F77_INT) { } void bar_64 (octave_idx_type) { } int main (void) { octave_idx_type octave_idx_val = 0; F77_INT f77_int_val = 0; // error: cannot convert ‘octave_idx_type* {aka long int*}’ // to ‘const F77_INT* {aka const int*}’ // for argument ‘1’ to ‘void foo_32(const F77_INT*)’ foo_32 (&octave_idx_val); // OK, same pointer types foo_64 (&octave_idx_val); // OK, same pointer types foo_32 (&f77_int_val); // error: cannot convert ‘F77_INT* {aka int*}’ // to ‘const octave_idx_type* {aka const long int*}’ // for argument ‘1’ to ‘void foo_64(const octave_idx_type*)’ foo_64 (&f77_int_val); // -Wconversion is required to see this warning // warning: conversion to ‘F77_INT {aka int}’ // from ‘octave_idx_type {aka long int}’ // may alter its value [-Wconversion] bar_32 (octave_idx_val); // OK, equal sizes bar_64 (octave_idx_val); // OK, equal sizes bar_32 (f77_int_val); // OK, smaller int assigned to larger bar_64 (f77_int_val); return 0; }