TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: DENNIS LEE BIEBER
date: 2020-01-22 11:57:00
subject: Re: Rephrasing my ALSA qu

On Wed, 22 Jan 2020 11:34:29 +0100, "R.Wieser" 
declaimed the following:

>Hello all,
>
>I've found a simple tutorial here
>http://www.linuxjournal.com/article/6735?page=0,0 and have a bit of a
>problem with listing #3.
>
>First off , when I executed the program it had a long delay executing the
>"snd_pcm_hw_params_set_rate_near()" function, which turned out to be related
>to the "dir" argument not being initialised (with Zero).
>
>#1: I'm using gcc on a Raspberry Pi in geany.  Is there some sort of setting
>I should add to have gcc include code to automatically clear declared
>variables ?
>
>Or should I assume that the code simply isn't complete (would explain a few
>things).
>

 Well, you could add compile option

-Wuninitialized
"""
Warn if an automatic variable is used without first being initialized.
"""

and find most of those conditions. NOTE that there likely isn't any option
to force memory to 0 on first usage since so much of C is stack based and
zeroing stack memory each time a function returns (shrinking the stack)
would be a costly overhead... cf:
https://stackoverflow.com/questions/10526602/is-there-a-gcc-flag-to-initialise-
local-variable-storage
"""
C99: If an object that has automatic storage duration is not initialized
explicitly, its value is indeterminate.
"""


--
 Wulfraed                 Dennis Lee Bieber         AF6VN
 wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.