Advertencia de C ++ GCC4.4: el subíndice de matriz está por encima de los límites de la matriz
Recientemente actualicé a GCC 4.4 (compilación de MinGW TDM) y ahora el siguiente código produce estas advertencias:
En la función miembro 'void Console :: print (const std :: string &)':
advertencia: el subíndice de matriz está por encima de los límites de la matriz
Aquí está el código:
void Console::print( const std::string& str ) {
std::string newLine( str );
if( newLine.size() > MAX_LINE_LENGTH ) {
sf::Uint32 stringSize = newLine.size();
for( sf::Uint32 insertPos = MAX_LINE_LENGTH;
insertPos < stringSize; insertPos += MAX_LINE_LENGTH ) {
newLine.insert( insertPos, "\n" );
}
}
StringList tokens;
boost::split( tokens, newLine, boost::is_any_of("\n") );
for( StringList::iterator it = tokens.begin();
it != tokens.end(); ++it ) {
addLine( *it );
}
}
¿Algunas ideas?
Son las optimizaciones las que lo están haciendo ...
También parece ser esta línea la que lo está causando:
boost::split( tokens, newLine, boost::is_any_of("\n") );
Ah, sí, lo encontré, es el argumento de boost :: is_any_of (), envolviéndolo en un constructor de cadenas () la advertencia desaparece, gracias a todos por su ayuda :)
boost::split( tokens, newLine, boost::is_any_of( string( "\n" ) ) );