由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Question: How to store initialize arguments?
相关主题
Default function template argumentsshared_ptr处理stack上面的指针
ajax小问题问个gdb的问题
static如何作为函数?how to proof (转载)
one more interview questionquestion about using Hive parameter (转载)
问一个C++问题:default parameter and overriding/inheritanc (转载)如果python command line positional arguments 里有些是运算,那这种argument 该怎么处理?
difference between: char** p and char*p[] ??static initialization dependency c++
C++ Q 103-105 (转载)one question about initializaiton list
有谁懂 php 的?问个问题(有包子)how to initialize associate data in STL map
相关话题的讨论汇总
话题: arguments话题: question话题: initialize话题: xxxx话题: action
进入Programming版参与讨论
1 (共1页)
z***e
发帖数: 5393
1
(回家用汉语补充了一下,方便阅读)
for example, we have a program running with arguments:
(简单说就是像下面这种要带很多参数的程序,程序里面要根据action参数进行不同的动作,比如可能是网络连接,可能是打字,可能是写文件,然后每个动作都有自己的特定参数从命令行里面读取,那么,怎么设计class或者whatever来漂亮处理这些参数?)
myprogram -action xxxx -name xxxx -password xxxx -ipaddress xxxx -portnumber
xxxx [....]
Inside the program, we have different actions, and each action has its own
parameters from the commandline arguments. For example, action1 may need
ipaddress and portnumber, action2 may need username and password,
s******e
发帖数: 431
2
Wrapping everything in a configuration class and pass the pointer to the
function is okay. And when a new parameter needs to be added, the interface
doesn't need to be changed.
However, it is also increasing the complexity for users to use the function
(action). It is hard to know how many parameters are required to do this
action.
1 (共1页)
进入Programming版参与讨论
相关主题
how to initialize associate data in STL map问一个C++问题:default parameter and overriding/inheritanc (转载)
Malab里调用第三方的java class,总是不成功。difference between: char** p and char*p[] ??
Python 下载数据请教。C++ Q 103-105 (转载)
请问运行python的一些技巧。有谁懂 php 的?问个问题(有包子)
Default function template argumentsshared_ptr处理stack上面的指针
ajax小问题问个gdb的问题
static如何作为函数?how to proof (转载)
one more interview questionquestion about using Hive parameter (转载)
相关话题的讨论汇总
话题: arguments话题: question话题: initialize话题: xxxx话题: action