Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 156786 - console truncate the gcc output
Summary: console truncate the gcc output
Status: RESOLVED DUPLICATE of bug 71511
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: cdt-build-inbox@eclipse.org CLA
QA Contact: Andrew Gvozdev CLA
URL:
Whiteboard:
Keywords:
: 156788 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-09-08 20:56 EDT by Pietro Incardona CLA
Modified: 2012-03-22 00:30 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pietro Incardona CLA 2006-09-08 20:56:33 EDT
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main()
{
	double var2 = 3;
	char string1[] = "hello";
	char string2[] = "hello2";
	
	strncpy(string1,string2);        // <-------- a compiler error
	
	
	var2 = string1                    //   <----- a compiler error
}

This code generate compiler error the error message for gcc is

prova.cpp:17:2: warning: no newline at end of file
prova.cpp: In function ‘int main()’:
/usr/include/string.h:89: error: too few arguments to function ‘char* strncpy(char*, const char*, size_t)’
prova.cpp:13: error: at this point in file
prova.cpp:16: error: cannot convert ‘char [6]’ to ‘double’ in assignment
prova.cpp:17: error: expected `;' before ‘}’ token

but on Eclipse Console the output is:


**** Build of configuration Debug for project ProvaSearch ****

make -k all 
Building file: ../prova.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"prova.d" -MT"prova.d" -o"prova.o" "../prova.cpp"
../prova.cpp:17:2: warning: no newline at end of file
../prova.cpp: In function ‘int main()’:
Build complete for project ProvaSearch 

The console output is truncated, this kind of truncation seem to occur in
general if number of arguments don' t correspond with definition

correcting the strncpy error with for example  "strncpy(string1,string2,5);":
there isn' t the truncation all error are reported correctly


**** Build of configuration Debug for project ProvaSearch ****

make -k all 
Building file: ../prova.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"prova.d" -MT"prova.d" -o"prova.o" "../prova.cpp"
../prova.cpp:17:2: warning: no newline at end of file
../prova.cpp: In function ‘int main()’:
../prova.cpp:16: error: cannot convert ‘char [6]’ to ‘double’ in assignment
../prova.cpp:17: error: expected `;' before ‘}’ token
make: *** [prova.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project ProvaSearch

The problem is not limited to console infact eclipse in the first "with truncation" case sign 0 error, in the second sign correctly 3 error
Comment 1 Anton Leherbauer CLA 2008-03-14 07:47:32 EDT
*** Bug 156788 has been marked as a duplicate of this bug. ***
Comment 2 Andrew Gvozdev CLA 2012-03-22 00:30:32 EDT
I think this could've been solved with bug 71511.

*** This bug has been marked as a duplicate of bug 71511 ***