T O P I C R E V I E W |
alextooter |
Posted - Jun 12 2006 : 01:24:51 AM When I want to refactoring some C code, 1522 will using the C++ technology "reference", but there is no reference in C, so those code can't be compiled,
example
orignail c code
GLOBAL void tcpmDoUdpRegisterReq(T_TCPIP_UDPREG_REQ *tcpip_udpreg_req) { struct socket *so_p; UdpRegisterCnf udpRegisterCnf; T_TCPIP_UDPALLOCATE_REQ udpAllocateReq; UdpAllocateCnf udpAllocateCnf; /* * i will refactoring the following code using extract method * begin: */ udpRegisterCnf.tsapi = tcpip_udpreg_req->tsapi; udpRegisterCnf.localPort = 0; udpRegisterCnf.localAddress.addr.addrV4 = 0; udpRegisterCnf.localAddress.addrType = IP_V4_ADDRESS; udpRegisterCnf.isRegister = tcpip_udpreg_req->isRegister; udpRegisterCnf.recvSize = 0; udpRegisterCnf.sendSize = 0; udpRegisterCnf.commandRef = tcpip_udpreg_req->commandRef; /* * end. */ }
after refactoring:
void MyMethod (UdpRegisterCnf &udpRegisterCnf, //here is the problem, no & in C T_TCPIP_UDPREG_REQ *tcpip_udpreg_req)
{ udpRegisterCnf.tsapi = tcpip_udpreg_req->tsapi; udpRegisterCnf.localPort = 0; udpRegisterCnf.localAddress.addr.addrV4 = 0; udpRegisterCnf.localAddress.addrType = IP_V4_ADDRESS; udpRegisterCnf.isRegister = tcpip_udpreg_req->isRegister; udpRegisterCnf.recvSize = 0; udpRegisterCnf.sendSize = 0; udpRegisterCnf.commandRef = tcpip_udpreg_req->commandRef; }
GLOBAL void tcpmDoUdpRegisterReq(T_TCPIP_UDPREG_REQ *tcpip_udpreg_req) { struct socket *so_p; UdpRegisterCnf udpRegisterCnf; T_TCPIP_UDPALLOCATE_REQ udpAllocateReq; UdpAllocateCnf udpAllocateCnf; MyMethod(udpRegisterCnf, tcpip_udpreg_req); } |
4 L A T E S T R E P L I E S (Newest First) |
support |
Posted - Aug 12 2006 : 11:22:39 PM Case 1317 is fixed in build 1532. |
feline |
Posted - Jun 14 2006 : 5:56:32 PM i am seeing the same thing
case=1317
for now the best advice is to either select the extracted method and use find / replace on the selected code to turn "foo." into "foo->" and then fix any errors, or to avoid extract method in C for now. most (or even all) of the other refactoring operations should be fine in C. |
alextooter |
Posted - Jun 13 2006 : 8:23:01 PM I am using vc6, and this project is a C project (for handset). |
feline |
Posted - Jun 13 2006 : 5:09:46 PM which IDE are you using? VS2003 does not seem keen on me adding a C file to my C++ project |