我有以下代碼:C函數指針參數打印問題
struct cache_t * /* pointer to cache created */
cache_create(char *name, /* name of the cache */
int nsets, /* total number of sets in cache */
int bsize, /* block (line) size of cache */
int balloc, /* allocate data space for blocks? */
int usize, /* size of user data to alloc w/blks */
int assoc, /* associativity of cache */
enum cache_policy policy, /* replacement policy w/in sets */
/* block access function, see description w/in struct cache def */
unsigned int (*blk_access_fn) (enum mem_cmd cmd,
md_addr_t baddr, int bsize,
struct cache_blk_t * blk,
tick_t now,
int context_id),
unsigned int hit_latency)
{ /* latency in cycles for a hit */
struct cache_t *cp;
struct cache_blk_t *blk;
int i, j, bindex;
----
----
---
cp->blk_access_fn = blk_access_fn;
----
---
我想打印context_id和baddr。我該怎麼做 ? 我試過類型轉換和所有東西,但它總是給我錯誤: 符號「context_id」在當前上下文中無效。 幫助會很高興。
你總是可以用'indent -kr'命令在linux中縮進'C'代碼 –