Questions on behavior of code

This is a discussion on Questions on behavior of code within the C++ Programming forums, part of the General Programming Boards category; I am having problem understanding the behavior of the code below, can somebody advise me on how the function behave ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    1

    Questions on behavior of code

    I am having problem understanding the behavior of the code below, can somebody advise me on how the function behave and work?This is a function that suppose to add or drop data from a hardware device. Thanks.


    bit OADM_AddDrop(void)
    {
    bit bDropOADS=0, bAddOADS=0;
    int i=0, iPortValue=0, iPorts=pMsg[0], j=0;
    //sbit SetBit;

    if(iPorts>PORT_SWITCH_MAX) return false; //every call can only set up to 8 ports/mirrors

    for(i=0; i<iPorts; i++)
    {
    iPortValue=pMsg[i+1];

    if(iPortValue>0 && iPortValue<9) //from 1 to 64
    {
    //////////testing//////////////
    ACC='K';
    TX_BYTE();
    ACC='K';
    TX_BYTE();
    ACC=iPortValue;
    TX_BYTE();
    ACC=pCardStatus[STATUS_DROP_BYTE];
    TX_BYTE();
    ACC='K';
    TX_BYTE();
    ACC='K';
    TX_BYTE();
    /////////////////////////////////

    j=iPortValue-1;
    if (j==0)
    {SetBit10=pCardStatus[STATUS_DROP_BYTE]^0; SetBit10=1;}
    if (j==1)
    {SetBit11=pCardStatus[STATUS_DROP_BYTE]^1; SetBit11=1;}
    if (j==2)
    {SetBit12=pCardStatus[STATUS_DROP_BYTE]^2; SetBit12=1;}
    if (j==3)
    {SetBit13=pCardStatus[STATUS_DROP_BYTE]^3; SetBit13=1;}
    if (j==4)
    {SetBit14=pCardStatus[STATUS_DROP_BYTE]^4; SetBit14=1;}
    if (j==5)
    {SetBit15=pCardStatus[STATUS_DROP_BYTE]^5; SetBit15=1;}
    if (j==6)
    {SetBit16=pCardStatus[STATUS_DROP_BYTE]^6; SetBit16=1;}
    if (j==7)
    {SetBit17=pCardStatus[STATUS_DROP_BYTE]^7; SetBit17=1;}

    /*if (j==0) SetBit10=1;
    if (j==1) SetBit11=1;
    if (j==2) SetBit12=1;
    if (j==3) SetBit13=1;
    if (j==4) SetBit14=1;
    if (j==5) SetBit15=1;
    if (j==6) SetBit16=1;
    if (j==7) SetBit17=1;*/

    bDropOADS=true;

  2. #2
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C interview questions
    By natrajdreams in forum C Programming
    Replies: 7
    Last Post: 12-12-2010, 11:40 AM
  2. Replies: 23
    Last Post: 04-20-2009, 07:35 AM
  3. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21