Message from C, C++ discussions

January 2020

— Could it be because of some empty stream / pointer that leaks memory and then any memory operation creates random segfaults?

Message permanent page

— 

Pa_Initialize();

auto params = new PaStreamParameters;
params->device = Pa_GetDefaultOutputDevice();
params->channelCount = 2;
params->sampleFormat = paInt32;
params->suggestedLatency = Pa_GetDeviceInfo(params->device)->defaultLowOutputLatency;
params->hostApiSpecificStreamInfo = nullptr;

SNDFILE *snd_file = nullptr;
SF_INFO *sf_info = (SF_INFO*)malloc(sizeof(sf_info));
// SF_INFO *sf_info;
// ::memset(sf_info, 0, sizeof(sf_info));
snd_file = sf_open("../res/test.wav", SFM_READ, sf_info);

PaStream *stream;
Pa_OpenStream(&stream, nullptr, params, sf_info->samplerate, paFramesPerBufferUnspecified, paClipOff, stream_callback, nullptr);

Pa_StartStream(stream);

int sub_format = sf_info->format & SF_FORMAT_SUBMASK;
printf("%d", sf_info->format);

— If I add anything after this for example double a = 0.0; it throws segfault

— Oh it's caused because of portaudio i guess? /shrug

— ¯\_(ツ)_/¯

— Sizeof(sf_info) are different from sizeof(SF_INFO)

— Sf_info is a pointer,well SF_INFO is a type

— Any C++ tutorials to understand system on Chip Softwares or Embedded Systems ?

— Books will also suffice.

— Banned from google ?

— C++ experts >>> Google

— Seems like C++ experts don't use google search. 🤔🤔🤔