Skip to content

Commit

Permalink
Fixed GCC warning in release.
Browse files Browse the repository at this point in the history
  • Loading branch information
corbett5 committed Sep 9, 2021
1 parent 2e289ce commit 9e778b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/arrayManipulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,13 @@ void resize( T * const LVARRAY_RESTRICT ptr,
{
if( newSize - size > 0 )
{
memset( reinterpret_cast< void * >( ptr + size ), 0, ( newSize - size ) * sizeof( T ) );
std::memset( reinterpret_cast< void * >( ptr + size ), 0, ( newSize - size ) * sizeof( T ) );
}
}
else
{
for( std::ptrdiff_t i = size; i < newSize; ++i )
// Use std::size_t so that when GCC optimizes this it doesn't produce sign warnings.
for( std::size_t i = size; i < std::size_t( newSize ); ++i )
{
new ( ptr + i ) T( std::forward< ARGS >( args )... );
}
Expand Down

0 comments on commit 9e778b0

Please sign in to comment.