Re: Get local date / hour



Paul Davis wrote:

On Mon, 2006-03-13 at 16:55 -0600, Bob Caryl wrote:
Paul Davis wrote:

just a quick heads up: the memset is unnecessary and strftime(3) is more
portable.

Hey Paul,

Different strokes, ok? I've been writing "C" programs for over 20 years and old habits die hard. I initialize every variable I declare inside a function (even if that variable is NOT on the stack) whether it needs

your sprintf call initializes it again. in both cases, you have a
function call doing variable initialization, not an assignment
operation. that's all i meant by unnecessary. if i'm going to continue
with my hated assignment as language lawyer, i would note my own feeling
that sprintf() should never ever be used; snprintf() is vastly safer.
now shoot me :)

it or not. And, since strftime(3) uses the same structure (struct tm) that I did to create my string, what makes it "more portable"?

in this particular case nothing. but a minor tweak of this function
could lead to a case where locale should be taken into account and is
not.

sorry for being a language lawyer.

--p



Hmmm..... a lawyer that wants to get shot... I'll see if I can wangle you an invite on Dick Cheney's next hunting trip. :-P

Bob


begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]