Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How does calloc work in C code?

Status
Not open for further replies.

samtronxindia

Newbie level 5
Joined
Jul 18, 2012
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
San Antonio,TX
Activity points
1,332

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
struct bpred_t *            /* branch predictory instance */
bpred_create(enum bpred_class class,    /* type of predictor to create */
         unsigned int bimod_size,   /* bimod table size */
         unsigned int l1size,   /* 2lev l1 table size */
         unsigned int l2size,   /* 2lev l2 table size */
         unsigned int meta_size,    /* meta table size */
         unsigned int shift_width,  /* history register width */
         unsigned int xor,      /* history xor address flag */
         unsigned int btb_sets, /* number of sets in BTB */ 
         unsigned int btb_assoc,    /* BTB associativity */
         unsigned int retstack_size) /* num entries in ret-addr stack */
{
  struct bpred_t *pred;
 
  if (!(pred = calloc(1, sizeof(struct bpred_t))))
    fatal("out of virtual memory");






I want to know what the last part of the code i.e: If statement does..
 
Last edited by a moderator:

Re: A C Code to Decipher

It just displays a error if you fall out of memory.
 

Re: A C Code to Decipher

No thats ok but the reason why I posted it is , how is it doing that. For example can you explain me word by word that if statement please ...
 


Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top