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 to solve Spurious pointer conversion ?

Status
Not open for further replies.

milan.rajik

Banned
Advanced Member level 5
Joined
Apr 1, 2013
Messages
2,524
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Visit site
Activity points
0
I am doing a GSM based Device control project. I have two functions. One is to send AT Commands and another to send SMS. I am calling GSM_Send_Const_Cmd() inside GSM_Send_SMS() function. I am passing address of two variables index and attempt to GSM_Send_Const_Cmd() (idx, attempt) and the same pointers have to be passed to GSM_Send_Const_Cmd() from GSM_Sens_SMS()

I am getting Spurious pointer conversion messages in Compiler related to idx and attempt arguments.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
void GSM_Send_Const_Cmd(char *s1, char *s2, const char *s3, const char *s4, unsigned int *idx, char *attempt, char clr) {
 
      while(strstr(s1, CopyConst2Ram(s2, s3)) == 0) {
              UART1_Write_Text(CopyConst2Ram(s2, s4));
              Delay_ms(2000);
 
              if(*attempt++ == 3) {
                  GSM_RESET();
                  memset(s1, '\0', sizeof(s1));
                  *attempt = 0;
                  *idx = 0;
              }
      }
 
      if(clr)memset(s1, '\0', sizeof(s1));
      *attempt = 0;
      *idx = 0;
}
 
void Send_SMS(char *s1, char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, char *s8, unsigned int *idx, char *attempt, char clr) {
 
    while(strstr(s1, CopyConst2Ram(s2, s3)) == 0) {
 
       GSM_Send_Const_Cmd(s1, s2, s3, s5, &idx, &attempt, 1);
       GSM_Send_Const_Cmd(s1, s2, s3, s6, &idx, &attempt, 1);
       GSM_Send_Const_Cmd(s1, s2, s4, s7, &idx, &attempt, 1);
 
       UART1_Write_Text(s8);
       Delay_ms(500);
       UART1_Write(0x1A);
 
       Delay_ms(8000);
    }
 
    memset(s1, '\0', sizeof(s1));
    *idx = 0;
}



- - - Updated - - -

I got it.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
unsigned int attempt = 0;
 
void ptrtest(unsigned int *atmpt) {
 
     (*atmpt)++;
 
}
 
void ptr2test(unsigned int *atmpt2) {
     
     ptrtest(atmpt2);
}
 
ptrtest(&attempt);
    
ptr2test(&attempt);

 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top