Steve Litt writes:
> On Thu, 10 Dec 2015 12:28:15 +
> Rainer Weikusat wrote:
>
>> *p = 5
>>
>> is undefined behaviour.
>
> Not in the good old days. Anyone remember DOS' infamous B800 address?
'undefined behaviour' is a term from the C standard and 'using the value
of an object with automat
Hi Ron,
On 12/13/2015 10:48 PM, Renaud (Ron) OLGIATI
wrote:
*p = 5
> >
> >is undefined behaviour.
>
>Not in the good old days. Anyone remember DOS' infamous B800 address?
>
>But of course in 2015, my response is offtopic.
Abend 0C7 (or 0CB) anyone ?
Cheers,
Ron.
-- Physics is like sex:
On Sun, 13 Dec 2015 13:25:02 -0500
Steve Litt wrote:
> > *p = 5
> >
> > is undefined behaviour.
>
> Not in the good old days. Anyone remember DOS' infamous B800 address?
>
> But of course in 2015, my response is offtopic.
Abend 0C7 (or 0CB) anyone ?
Cheers,
Ron.
--
Ph
On Thu, 10 Dec 2015 12:28:15 +
Rainer Weikusat wrote:
> *p = 5
>
> is undefined behaviour.
Not in the good old days. Anyone remember DOS' infamous B800 address?
But of course in 2015, my response is offtopic.
SteveT
Steve Litt
November 2015 featured book: Troubleshooting Techniques
On Fri, Dec 11, 2015 at 01:04:18PM +0100, Irrwahn wrote:
>
> [pedantic mode=full] There is no C/C++ language. Those
> are two distinct languages, looking uncannily similar
> in places. Unfortunately. [pedantic/]
Nonetheless, it is possible, and even practical, to write a program
in the interse
On Fri, Dec 11, 2015 at 11:23:24AM +, KatolaZ wrote:
>
> C is one of the few remaining languages which is consistent about
> allowing only one of the many possible argument passing
> mechanisms. And the mechanism chosen by C is pass-by-value. Fullstop.
Historical note: it may have picked up t
[top-posting fixed]
On Fri, 11 Dec 2015 12:25:00 +0100, Aitor Czr wrote:
> On 12/11/2015 10:04 AM, Irrwahn wrote:
>> Ceterum censeo: There is no pass by reference in C,
>> has never been, and will presumably never be. Heck,
>> the C standard doesn't mention the concept at all,
>> not even in a no
Of course :-)
On 12/11/2015 12:23 PM, KatolaZ wrote:
This is not being pedantic, but calling things with their name, and avoiding
confusion.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Maybe...
Here you are the same program written in both languages:
CASE 1 (C Language):
# include
void func(int*);
int main(void)
{
int i=1;
func(&i);
printf( "%d", i);
return 0;
}
void func(int *x)
{
*x = 2;
}
CASE 2 (C++ Language):
#include
void func(int &);
int main()
{
On Fri, Dec 11, 2015 at 09:01:19AM +0100, aitor_czr wrote:
> Hi Katolaz,
>
> Here you are an example of two arguments (x,y) passed by reference:
[cut]
>
> void func(int *x, int *y)
> {
> int k = *x;
> *x = *y;
> *y = k;
> }
>
> This is the output:
>
> i = 1 j = 2
> i = 2 j = 1
>
Dear A
[top-posting fixed]
On Fri, 11 Dec 2015 10:59:05 +0100, Aitor Czr wrote:
> On 12/11/2015 10:04 AM, Irrwahn wrote:
>> Ugh, this explains a lot! Books by Herbert Schildt
>> are, sit venia verbo, the most useless utter crap
>> you can get. The only thing this book documents is
>> the total incomp
On Fri, 11 Dec 2015 09:49:25 +, Arnt Gulbrandsen wrote:
> aitor_...@gnuinos.org writes:
>> They wrote the following book:
>>
>> "The C programming language"
>
> I read both editions in my time and... isn't there anything better yet? The
> book is short and gets to the point, but the code samp
Maybe it doesn't deserve a Pulitzer :)
Aitor.
On 12/11/2015 10:04 AM, Irrwahn wrote:
Ugh, this explains a lot! Books by Herbert Schildt
are, sit venia verbo, the most useless utter crap
you can get. The only thing this book documents is
the total incompetence of its author. Have a good
laugh
aitor_...@gnuinos.org writes:
They wrote the following book:
"The C programming language"
I read both editions in my time and... isn't there anything better yet? The
book is short and gets to the point, but the code samples are terribly
happypathish, with weak and unstated pre- and postcondi
[top posting fixed]
On Fri, 11 Dec 2015 10:31:08 +0100, Aitor Czr wrote:
> On 12/11/2015 10:04 AM, Irrwahn wrote:
>> If you want an overall introductory book to C, get
>> K&R2, written by someone who understood C, if only
>> because he invented the language. :P If you want an
>> authoritative
They wrote the following book:
"The C programming language"
Aitor.
On 12/11/2015 10:31 AM, aitor_czr wrote:
Hi Irrwahn,
Are you referring to Brian Kernighan and Dennis Ritchie?
Aitor.
On 12/11/2015 10:04 AM, Irrwahn wrote:
If you want an overall introductory book to C, get
K&R2, wri
Hi Irrwahn,
Are you referring to Brian Kernighan and Dennis Ritchie?
Aitor.
On 12/11/2015 10:04 AM, Irrwahn wrote:
If you want an overall introductory book to C, get
K&R2, written by someone who understood C, if only
because he invented the language. :P If you want an
authoritative refere
On Fri, 11 Dec 2015 09:01:19 +0100, Aitor Czr wrote:
[...]
> Passing by value and passing by reference in ANSI C99 are documented in the
> following book:
>
> C - The Complete Reference (by Herbert Schildt)
Ugh, this explains a lot! Books by Herbert Schildt
are, sit venia verbo, the most useles
Hi Katolaz,
Here you are an example of two arguments (x,y) passed by reference:
# include
int main(void)
{
int i=1;
int j=2;
printf( "i = %d j = %d \n", i,j);
func(&i, &j);
printf( "i = %d j = %d \n", i,j);
return 0;
}
void func(int *x, int *y)
{
int k = *x;
*x = *y;
*y = k;
On Thu, Dec 10, 2015 at 05:59:04PM +, Rainer Weikusat wrote:
> Edward Bartolo writes:
>
> [...]
>
> > Realloc uses two parameters: the first is a pointer whose allocation
> > is to be modified/reallocated. The second is the NEW number of bytes
> > required. In the function line 240 is:
> > a
Edward Bartolo writes:
[...]
> Realloc uses two parameters: the first is a pointer whose allocation
> is to be modified/reallocated. The second is the NEW number of bytes
> required. In the function line 240 is:
> active_wifi_list = realloc(active_wifi_list, (((z - 1)/2) +
> list_delta)*sizeof(v
Hi Aitor et al,
This is the working code. At least it worked with an initial
allocation of 1 structure instead of 10. I am using it with an initial
allocation of 10 structures. On this machine the code works and it
should also work in your case:
The code is attached.
Conside lines 236 - 240.
Li
On Thu, Dec 10, 2015 at 04:11:27PM +, KatolaZ wrote:
[cut]
>
> with
>
> $ gcc -std=c99 reference.c
>
> this is what I obtain:
>
> reference.c:3:16: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
> void myfun(int &a){
> ^
> reference.c: In function ‘main’:
> reference.
On Thu, Dec 10, 2015 at 05:00:58PM +0100, aitor_czr wrote:
> No, Katolaz, passing by value and passing by reference exist in C,
> at least in C99.
>
Could you please give a pointer to the place where this feature is
documented in the ANSI C99 standard? Because it seems that the GCC
crew has overl
Hi Katolaz,
Can you say me what returns in your system the following command:
$ echo $PEDANTIC_MODE
Is it set to FALSE?
Thanks in advance,
Aitor.
On 12/10/2015 02:20 PM, KatolaZ wrote:
OK, but that's*really* pedantic;)
HND
KatolaZ
___
Dng
No, Katolaz, passing by value and passing by reference exist in C, at
least in C99.
Aitor.
On 12/10/2015 02:08 PM, KatolaZ wrote:
Aitor, sorry for being pedantic on this, but "passing-by-reference"
exists only in C++, not in C.
___
Dng mailing l
On Thu, Dec 10, 2015 at 01:13:00PM +, Rainer Weikusat wrote:
[cut]
> > Hence, there is no way in C in which "p" and "&p" can be "the same
> > thing", especially if you have to decide to use either "p" or "&p" as
> > a first parameter of realloc...
>
> There is, but not in a way which would m
KatolaZ writes:
> On Thu, Dec 10, 2015 at 01:11:21PM +0100, aitor_czr wrote:
>> Hi Katolaz,
>>
>> In this case active_wifis is an argument passed by reference. So:
>>
>> active_wifis --> is the address
>> *active_wifis --> is the value
>>
>
> Aitor, sorry for being pedantic on this, but "passi
On Thu, Dec 10, 2015 at 01:11:21PM +0100, aitor_czr wrote:
> Hi Katolaz,
>
> In this case active_wifis is an argument passed by reference. So:
>
> active_wifis --> is the address
> *active_wifis --> is the value
>
Aitor, sorry for being pedantic on this, but "passing-by-reference"
exists only
On Thu, Dec 10, 2015 at 01:40:38PM +0100, aitor_czr wrote:
> Hi Katolaz,
>
> (Sorry if i send the same post several times, but many of them are
> being undelivered today)
>
> Try the folling code:
>
> int x = 5;
> int *p,*q;
>
> p=&x; // This is -> *p=5
> q=p;
>
> printf(" The values are:
Hi Katolaz,
(Sorry if i send the same post several times, but many of them are being
undelivered today)
Try the folling code:
int x = 5;
int *p,*q;
p=&x; // This is -> *p=5
q=p;
printf(" The values are:%d %d ", *p,*q);
printf(" The addresses are: %p %p ", p, q);
So:
1) active_w
Hi Katolaz,
Try the folling code:
int x = 5;
int *p,*q;
p=&x; // This is -> *p=5
q=p;
printf(" The values are:%d %d ", *p,*q);
printf(" The addresses are: %p %p ", p, q);
So:
1) active_wifis is the address
2) *active_wifis is the value
Aitor.
On 12/10/2015 12:56 PM, KatolaZ wro
aitor_czr writes:
> I rectify:
>
> p = &x; // This is -> *p=5
Considering
>> int x = 5;
>> int *p, *q;
>>
>> p = &x; // This is -> p=5
it's not. It's p = &x. Afterwards, *p will return whatever value x
happens to have. Prior to the assigned, p was (assuming auto variables)
a pointer wi
I rectify:
p = &x; // This is -> *p=5
On 12/10/2015 01:11 PM, aitor_czr wrote:
Hi Katolaz,
In this case active_wifis is an argument passed by reference. So:
active_wifis --> is the address
*active_wifis --> is the value
Try doing:
int x = 5;
int *p, *q;
p = &x; // This is -> p=5
q
Hi Katolaz,
In this case active_wifis is an argument passed by reference. So:
active_wifis --> is the address
*active_wifis --> is the value
Try doing:
int x = 5;
int *p, *q;
p = &x; // This is -> p=5
q = p;
printf(" The values are: %d %d ", *p, *q);
printf(" The addresses are:
On Thu, Dec 10, 2015 at 11:05:01AM +0100, aitor_czr wrote:
> Hi again,
>
> ... "active_wifis" and "&active_wifis" are the same ...
>
> So, forget the comment.
Sorry for the silly, uninformed, and preposterous comment, which you
would probably be better off ignoring altogether, but I can't se
Hi again,
... "active_wifis" and "&active_wifis" are the same ...
So, forget the comment.
The origin of the pointer error, as Edward said, is in the list of my
neighbouring active wifi points.
Now, i am in another house:
# ./backend 6
ESSID:"Orange-F879"
ESSID:"WLAN_74B3"
ESSID:"Orange-
Changing from:
realloc(active_wifis
to:
realloc(&active_wifis .
the pointer error disappears:
# ./backend 10
/sbin/ifup: interface wlan0 already configured
:)
Aitor.
On 12/10/2015 09:58 AM, aitor_czr wrote:
Sorry:
printf("\nactive_wifis = %i\n\n", *active_wifis);
On 12/10/2015 09:
Sorry:
printf("\nactive_wifis = %i\n\n", *active_wifis);
On 12/10/2015 09:30 AM, aitor_czr wrote:
Hi Edward,
The value of the integer parameter 'active_wifis', passed by reference
to 'getRadiatingWifiList' is lost. I added the following line 232:
[]
*active_wifis = -1;
char* tmp_buffer
Hi Edward,
The value of the integer parameter 'active_wifis', passed by reference
to 'getRadiatingWifiList' is lost. I added the following line 232:
[]
*active_wifis = -1;
char* tmp_buffer = scan_buffer;
printf("\nactive_wifis = %i\n\n", active_wifis); /* ADDED LINE /
while((scan
Hi Rainer,
Edited Makefile as you instructed me. Now, using "make -C ." in
netman/ directory creates two executables: netman (GUI frontend) and
backend (CLI backend).
Please ignore the "Sender" parameter not used warnings. It is normal
not to use Sender although there are instances where it is us
Edward Bartolo writes:
> Hi Rainer,
>
> This is Makefile from netman:
>
> ---
> all: backend netman
>
> backend:
> make -C backend_src
> cp backend_src/bin/backend .
>
> netman: netman.lpr
> lazbuild -B netman.lpr | awk '/./{p
Hi Rainer,
This is Makefile from netman:
---
all: backend netman
backend:
make -C backend_src
cp backend_src/bin/backend .
netman: netman.lpr
lazbuild -B netman.lpr | awk '/./{print $$0}'
clean:
make -C backend_src
Edward Bartolo writes:
> QUOTE:
>
> "NB: This also fixes the silly autoWirelessScanPlus_RN omission (by
> including all object files). But this is positively the last time I've
> either
>
> - created backend_src/obj by hand
> - created backend_src/bin by hand
> - added auto
Hi,
To compile manually the backend, cd to:
netman/backend_src/src
gcc -I../include -lm -Wall automated_scanner.c core_functions.c
essid_encoder.c file_functions.c backend.c -o backend
Edward
On 07/12/2015, Edward Bartolo wrote:
> Hi Reiner,
>
> QUOTE:
>
> "NB: This also fixes the silly autoWi
Hi Reiner,
QUOTE:
"NB: This also fixes the silly autoWirelessScanPlus_RN omission (by
including all object files). But this is positively the last time I've
either
- created backend_src/obj by hand
- created backend_src/bin by hand
- added automated_scanner.o by hand
aitor_czr writes:
> Now i get the following error trying to compile the backend:
>
> " ... automated_scanner.c:291: undefined reference to `pow' ... "
>
> The 'pow' function is part of the 'math' library. Therefore, the
> invokation of the compiler should be as follows:
>
> $ gcc -g -lm [...]
>
>
Hi Edward,
Now i get the following error trying to compile the backend:
" ... automated_scanner.c:291: undefined reference to `pow' ... "
The 'pow' function is part of the 'math' library. Therefore, the
invokation of the compiler should be as follows:
$ gcc -g -lm [...]
in order to link wit
Hi Aitor,
This is my latest edit of the code so that memory allocations are done
when needed instead of the iteration just before more memory is
required.
The edited code:
if (z == 1)
active_wifi_list = calloc(10, sizeof(void*));
else if ((z
Hi Edward,
I will try it later, thanks :)
Aitor.
On 12/06/2015 01:10 PM, Edward Bartolo wrote:
Hi Aitor,
I edited the code as follows:
if (z == 1)
active_wifi_list = calloc(10, sizeof(void*));
else if (z % 20 == 0)
Hi Aitor,
I edited the code as follows:
if (z == 1)
active_wifi_list = calloc(10, sizeof(void*));
else if (z % 20 == 0)
active_wifi_list = realloc(active_wifis, ((z/2) +
10)*sizeof(void*));
Please, if you can run th
Hi Aitor,
Nevermind, I confirmed it is the same line we are talking about. I
will investigate the source and reply back.
Edward
On 06/12/2015, Edward Bartolo wrote:
> Hi Aitor,
>
> Could you attach the source file so that I would be able to make sure
> we are talking about the same version?
>
>
Hi Aitor,
Could you attach the source file so that I would be able to make sure
we are talking about the same version?
Edward
On 06/12/2015, Edward Bartolo wrote:
> Hi Aitor,
>
> Is your list of neighbouring active wifi points larger than 9 or 10?
> If that is the case, we may have hit an untes
Hi Aitor,
Is your list of neighbouring active wifi points larger than 9 or 10?
If that is the case, we may have hit an untested code path. I will
review the code and post back.
Edward
On 06/12/2015, aitor_czr wrote:
> Hi all,
>
> In the case of an automatically attempt to connect with netman, i
Hi all,
In the case of an automatically attempt to connect with netman, i get
the following error:
$ ./backend 10
*** Error in `./backend': realloc(): invalid pointer: 0x7ffc3deb55f4 ***
Aborted
I believe there is an uncontrolled pointer somewhere...
IMHO (:-) ) the line 238 of ''automat
55 matches
Mail list logo