From: Satya Prakash Prasad <satyaprakash.prasad@gmail.com>
To: gcc@gcc.gnu.org
Subject: C++ - compilation error for all implicit conversion
Date: Mon, 05 Mar 2018 07:42:00 -0000 [thread overview]
Message-ID: <CACX5wch0cYKUVq7gYbCLYdVL0Sh5hCW+YGb637oZMRjTt_togQ@mail.gmail.com> (raw)
Is there a compiler flag that logs warning / error in case of any implicit
conversions - like int32_t to uint32_t.
#include <cstdint>
#include <iostream>
using ::std::int32_t;
using ::std::uint32_t;
int main(int argc, char *argv[])
{
int32_t x = 9;
uint32_t i = x;
uint32_t i1 = socketread(...); // returns int32_t -1 on error and >0
on success
std::cout << " " << x << " " << i << std::flush << std::endl;
return 0;
}
c++ -std=c++11 -Wall -Wconversion -Wpedantic cast.cpp
I get no issues / warning / error during compilation - is there a way it
can achieved.
next reply other threads:[~2018-03-05 7:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 7:42 Satya Prakash Prasad [this message]
2018-03-05 8:08 ` Liu Hao
2018-03-05 8:17 ` Satya Prakash Prasad
2018-03-05 8:30 ` Liu Hao
2018-03-05 8:34 ` Satya Prakash Prasad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACX5wch0cYKUVq7gYbCLYdVL0Sh5hCW+YGb637oZMRjTt_togQ@mail.gmail.com \
--to=satyaprakash.prasad@gmail.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).