From e2a5c84d37eca37f17c50e47a439b434970c96b5 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 26 Feb 2016 23:55:29 +0300 Subject: [PATCH] Use value-initialization instead of memory zeroing --- SDL2pp/AudioSpec.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/SDL2pp/AudioSpec.cc b/SDL2pp/AudioSpec.cc index bdf3569..c05b3c5 100644 --- a/SDL2pp/AudioSpec.cc +++ b/SDL2pp/AudioSpec.cc @@ -1,6 +1,6 @@ /* libSDL2pp - C++11 bindings/wrapper for SDL2 - Copyright (C) 2014 Dmitry Marakasov + Copyright (C) 2014-2016 Dmitry Marakasov This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,18 +19,14 @@ 3. This notice may not be removed or altered from any source distribution. */ -#include - #include namespace SDL2pp { -AudioSpec::AudioSpec() { - std::fill((char*)this, (char*)this + sizeof(SDL_AudioSpec), 0); +AudioSpec::AudioSpec() : SDL_AudioSpec{} { } -AudioSpec::AudioSpec(int freq, SDL_AudioFormat format, Uint8 channels, Uint16 samples) { - std::fill((char*)this, (char*)this + sizeof(SDL_AudioSpec), 0); +AudioSpec::AudioSpec(int freq, SDL_AudioFormat format, Uint8 channels, Uint16 samples) : SDL_AudioSpec{} { SDL_AudioSpec::freq = freq; SDL_AudioSpec::format = format; SDL_AudioSpec::channels = channels;