[ale] [OT] Anyone up for a 90 Day Wonder Challenge?

DJ-Pfulio djpfulio at jdpfu.com
Thu Dec 3 09:03:04 EST 2015


Pointers are easy.

Either they point to valid, allocated memory (or a function), or they point to
NULL. PERIOD.  A null pointer exception is much nicer than any bug that seems to
work.

char* myName=NULL;

myName = malloc( sizeof("1234546789") );
if ( NULL == myName ) return;  /* Always validate the desired memory allocation
worked */

/* do something interesting ; pass myName around, into functions, etc .... */

free(myName);
myName=NULL;

/* Any attempts to reference myName now will provide a null pointer exception
and crash (throw exception). */

BTW, I haven't written any C code that uses malloc() since .... 1995-ish, so
don't expect that to compile cleanly.  Writing clear C code is VERY important.
Sure, there are wasted statements, but there is a reason. Clarity. A good
compiler will optimize out any wasted code. Some of this code will be running in
50 yrs, perhaps longer. Make the source clear, always.

I don't expect a SmartPtr class to manage memory for me. They tend to do things
when I don't want and do it in a way different from what I'd like.

Simple. Good pointer management is an important skill for all programmers, even
python, java, and other languages that don't provide direct access to pointers.
 After all, what is a reference?  It is just a pointer.  Perl has references and
they are used ALL-THE-TIME.


On 12/03/2015 08:22 AM, Ed Cashin wrote:
> For some reason this statement reminded me that there was a critical
> supplement to all the C books I read.
> 
> Ted Jensen's pointer tutorial:
> 
>   http://pw1.netcom.com/~tjensen/ptr/pointers.htm
> 
> ... will eliminate any residual discomfort with pointers.  It's a gem.
> 
> 
> 
> On Wed, Dec 2, 2015 at 3:05 PM, Boris Borisov <bugyatl at gmail.com> wrote:
> 
>> I guess everybody is reading their C books. So quiet:)
>>
>> On Wednesday, December 2, 2015, Scott M. Jones <eff at dragoncon.org> wrote:
>>
>>> talky.io claims to do screen sharing.  That's why I'd like to test to
>>> see how well it works, and if it works at all for bare metal Linux.
>>>
>>> https://about.talky.io
>>>
>>>
>>>
>>> On 12/2/15 11:30 AM, DjPfulio wrote:
>>>>
>>>> The problem with web RTC is its only webcam based; how do we share
>>>> screens through it? that's the problem.
>>>>
>>>> On 2 December 2015 10:08:09 GMT-05:00, "Scott M. Jones"
>>>> <eff at dragoncon.org> wrote:
>>>>
>>>>     On 11/26/15 6:41 AM, Leam Hall wrote:
>>>>
>>>>         Soo...Scott, does that mean you're volunteering to be a resident
>>>>         mentor? :P
>>>>
>>>>
>>>>     I'd be interested in helping to the extent that I can.  We went to
>>> C++
>>>>     in 2001 and Java in 2006, and sinc>     options.  One possibility
>>> not mentioned so far is talky.io <http://talky. <http://talky.io>>
>>> __________
>>
>>


More information about the Ale mailing list