Use %zu to print sizeof(x) with printf

Message ID 1227303850-11494-1-git-send-email-sven.eckelmann@gmx.de (mailing list archive)
State Rejected, archived
Headers

Commit Message

Sven Eckelmann Nov. 21, 2008, 9:44 p.m. UTC
  sizeof returns size_t (a unsigned integer with a high bit count) and has to be
printed with the prefix before length motifier.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman-experimental/control.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
  

Patch

diff --git a/batman-experimental/control.c b/batman-experimental/control.c
index de65e89..9491019 100644
--- a/batman-experimental/control.c
+++ b/batman-experimental/control.c
@@ -57,7 +57,7 @@  void init_control( void ) {
 	
 	// just to check if sizeof( struct xyz { char[] }__attribute__((packed)); ) is zero for all compilers...
 	if ( sizeof( struct cntl_msg ) != 20 ) {
-		printf( "sizeof cntl_msg %d MUST BE 20 !!!\n", sizeof( struct cntl_msg ) ); 
+		printf( "sizeof cntl_msg %zu MUST BE 20 !!!\n", sizeof( struct cntl_msg ) );
 		exit(EXIT_FAILURE);
 	}