Default values for array arguments

前端 未结 6 825
孤独总比滥情好
孤独总比滥情好 2021-01-04 06:53

Just playing around a little with C++. What I really want to do is to be able to setup a function with default values defined for an array or pointer argument. To keep thing

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-04 07:18

    "abc" is an expression, {'a', 'b', 'c'} is a static initializer. The later is only allowed in variable declarations. For reasons unknown to me argument with default value has different grammar rule that does not allow static initializers.

    There are some significant changes to when static initializers are allowed in C++0x, but I am not sure how it affect the case in question.

提交回复
热议问题