user312823
user312823

Reputation: 1

warning for int to long

is there a option in gcc compiler/ pclint for error/warning for int to long conversion.

Upvotes: 0

Views: 511

Answers (1)

anon
anon

Reputation:

Int to long should be OK. For long to int see , -Wconversion:

int main() {
    long long l = 0;
    int n = l;
}

then

gcc -Wconversion wc.c

gives:

wc.c:3: warning: conversion to 'int' from 'long long int' may alter its value

Upvotes: 2

Related Questions