> ======================================================================== > http://mondrian.corp.google.com/file/8165297///depot/googleclient/gears/opensource/gears/base/common/js_types.cc?a=2 > File //depot/googleclient/gears/opensource/gears/base/common/js_types.cc > (snapshot 2) > ------------------------------------ > Line 2250: if (i >= GetArgumentCount()) { > From what I can tell, there are code paths where 'was_specified' won't > necessarily get set. Should we set all array elements to 'false' up-front? I think the only 'success' code path where this can happen is the 'return true' on line 2271, where we return early if trailing optional arguments are not supplied. But I think you're right, it's best to just initialize all arguments to unspecified up front.
> ======================================================================== > http://mondrian.corp.google.com/file/8165297///depot/googleclient/gears/opensource/gears/base/common/js_types.h?a=2 > File //depot/googleclient/gears/opensource/gears/base/common/js_types.h > (snapshot 2) > ------------------------------------ > Line 531: // of a native object. Arguments may be required or optional and > these types > Required and optional args can't really be interspersed freely, right? I > think > it's more like zero or more required arguments, followed by zero or more > optional arguments. The new version of GetArguments does allow them to be interspersed. I've added to testPassArgumentsOptional() to test this behaviour. Note that none of the existing call sites make use of this. > ======================================================================== > http://mondrian.corp.google.com/file/8165297///depot/googleclient/gears/opensource/gears/blob/blob.cc?a=1 > File //depot/googleclient/gears/opensource/gears/blob/blob.cc (snapshot 1) > ------------------------------------ > Line 120: if (!argv[1].was_specified) { > Regarding the previous comment, I think this value may be uninitialized in > certain cases? You're right - fixed by above change. > ======================================================================== > http://mondrian.corp.google.com/file/8165297///depot/googleclient/gears/opensource/gears/ui/common/permissions_dialog.cc?a=1 > File > //depot/googleclient/gears/opensource/gears/ui/common/permissions_dialog.cc > (snapshot 1) > ------------------------------------ > Line 163: extra_message = STRING16(L""); > Is there any plan to set unspecified optional arguments to default values? I don't think so, so long as the value of was_specified can be relied upon. GetArguments won't change the values of arguments that aren't specified, so the caller can set a default before making the call. New snapshot uploaded. Steve
