Something I'm Missing...

This is a discussion on Something I'm Missing... within the C Programming forums, part of the General Programming Boards category; I can't figure out why i'm getting this error message. I know it's something simple. Code: void getSFPTransceiver(int device_id) { ...

  1. #1
    Registered User
    Join Date
    Sep 2007
    Location
    Boston
    Posts
    25

    Something I'm Missing...

    I can't figure out why i'm getting this error message. I know it's something simple.

    Code:
    void getSFPTransceiver(int device_id)
    {
      uint16_t temp_trans;
      SFP_A0_T *a0_ptr = ((SFP_A0_T *)&(sfp[device_id].addr.a0[0])); 
      
      for(a0_ptr->transceiver[1] && BIT(4))                      //<-- line 411
        {
          temp_trans = 0x00;
        }
    
      description[device_id].transceiver_i[1] = transceiver_adr3[temp_trans];
    
    }
    ../../../shared/driver/sfp.c: In function `getSFPTransceiver':
    ../../../shared/driver/sfp.c:411: parse error before ')' token
    cc1: warnings being treated as errors
    ../../../shared/driver/sfp.c:409: warning: unused variable `temp_trans'
    ../../../shared/driver/sfp.c: At top level:
    ../../../shared/driver/sfp.c:416: `device_id' undeclared here (not in a function)
    ../../../shared/driver/sfp.c:416: parse error before '.' token
    ../../../shared/driver/sfp.c:157: warning: `transceiver_adr3' defined but not used

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Code:
    for(a0_ptr->transceiver[1] && BIT(4))
    For loops have three parts, separated with semicolons. Perhaps you want "if".

    Also, if you're trying to do bitwise and, use & instead of &&.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Sep 2007
    Location
    Boston
    Posts
    25
    Quote Originally Posted by dwks View Post
    Code:
    for(a0_ptr->transceiver[1] && BIT(4))
    For loops have three parts, separated with semicolons. Perhaps you want "if".

    Also, if you're trying to do bitwise and, use & instead of &&.

    Duh!...

    Thanks very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  3. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  4. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  5. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM

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