Re: [Module-build-general] "0" options in compilation lines?
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2003-02-26 03:24:21
|
On Tuesday, February 25, 2003, at 06:56 PM, Randy W. Sims wrote:
> On 2/24/2003 1:04 PM, Ken Williams wrote:
>> Hi Randy,
>> I noticed this line in the format_compiler_cmd() code from your patch:
>> return [ grep {defined && $_} (
>> $spec{cc}, '-c' ,
>> @{$spec{includes}} ,
>> @{$spec{cflags}} ,
>> @{$spec{optimize}} ,
>> @{$spec{defines}} ,
>> @{$spec{perlinc}} ,
>> "-Fo$spec{output}" ,
>> $spec{source} ,
>> ) ];
>> I was wondering about the check for boolean truth, which will turn
>> argument lists like ('-foo', 0) into ('-foo'). Maybe it would be
>> safer to just use grep {defined()}, or grep {defined() && length()},
>> or something? Or are there some zeroes you're specifically trying to
>> filter out?
>> -Ken
>
> Your right. Bad habbit. I know it's bad for me, but I can't stop...
>
> I can't think of anyway in which it might fail, but it should be
> changed.
How about I just change it to
return [
$spec{cc}, '-c' ,
@{$spec{includes}} ,
@{$spec{cflags}} ,
@{$spec{optimize}} ,
@{$spec{defines}} ,
@{$spec{perlinc}} ,
"-Fo$spec{output}" ,
$spec{source} ,
];
? Seems like we'll want to know if one of those values is undefined
anyway, so we'll want to trigger the warning if warnings are turned on.
-Ken
|