1
老實說,我不知道如何發佈此問題...
我有一個全球性的動態列表是通過程序的所有功能可見,
今天,因爲這入榜從文件中填充讀取數據。
但現在我想有一個內部的「列表」,如果沒有指定文件,則加載它。
列表元素是這樣的:
動態列表
// odb tuple
typedef struct _odb_t
{
const char *name,*value;
struct _odb_t *next;
} odb_t;
enum _method {GET,POST};
// odb type binding
typedef struct _odb_type
{
enum _type type;
const char *value;
struct _odb_type *next;
} odb_type;
// defining online_db struct
typedef struct _odb
{
const char *host,*file,*patrn;
enum _method method;
odb_type *types;
odb_t *tuples;
pthread_t thread; // the thread that is using this host
struct _odb *next;
} odb;
我怎麼能有一個內部列表到.text段?
在此先感謝。
嗨,感謝您的回覆。 2件事: 1)'const * const'是錯誤的權利?! 2)爲什麼'const'在'odb'之後? 再次感謝! –
這是一個指向不可變對象的不可變指針。如果你需要'const'或不是由你決定。你的問題不夠精確,不知道你是否希望這個列表是可以修改的。 –
啊,在類型之後的'const'是一種可能性。我總是發現它更容易閱讀,因爲如果你這樣寫,'const'總是適用於左邊寫的東西。 –