From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16315 invoked by alias); 8 Oct 2008 23:03:22 -0000 Received: (qmail 15959 invoked by uid 48); 8 Oct 2008 23:02:02 -0000 Date: Wed, 08 Oct 2008 23:03:00 -0000 Message-ID: <20081008230202.15958.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/37765] Printf of typed null pointer causes a run-time error In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hosoda-t at palette dot plala dot or dot jp" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-10/txt/msg00602.txt.bz2 ------- Comment #2 from hosoda-t at palette dot plala dot or dot jp 2008-10-08 23:02 ------- (In reply to comment #1) > "%s" requires a pointer to a string, which (char*)0 isn't. "%s" is a c-style string. try the code below, and please notice that the code works well on g++ 3.4.4 and also on Microsoft Visual C++ 2005 without a run-time error. #include int main() { const char* p = "This is a c-syle string."; printf("%s\n", p); char* q = 0; printf("%s\n", q); } -- hosoda-t at palette dot plala dot or dot jp changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37765