Contributing Advent 4: MongoDB driver variable names
A while ago I started reading Expert C Programming, a book on the intricacies of C, written almost 20 years ago (in 1994). I can very greatly recommend this book, even for seasoned C developers. Even although I know about most of the subjects addressed in the book, I picked up a few new things as well.
Anyway, the book made me look at my default compiler flags again. I tended not to use -Wall at all, but I've since then expanded my CFLAGS to -Wall
-Wextra -Wdeclaration-after-statement -Wmissing-field-initializers
-Wshadow -Wno-unused-parameter. When running with the new flags, the MongoDB driver for PHP started throwing (among others) the following warning during compilation:
/home/derick/dev/php/derickr-mongo-php-driver/bson.c:1069:12: warning: declaration of ‘buffer’ shadows a global declaration [-Wshadow]
char *buffer;
^
At first I found this odd, as I could not find the declaration at all, until I looked closer at the location where the compiler though I had the error:
In file included from /home/derick/dev/php/derickr-mongo-php-driver/bson.c:26:0: /home/derick/dev/php/derickr-mongo-php-driver/php_mongo.h:301:3: warning: shadowed declaration is here [-Wshadow] } buffer; ^
And this pointed me to the buffer struct:
typedef struct {
char *start;
char *pos;
char *end;
} buffer;
This typedef declares buffer into the global scope and therefore the compiler rightfully warns us about this when trying to compile char
*buffer; in a function. The fix was to add the prefix mongo_ so that the new name becomes mongo_buffer. The mongo_ prefix is what we use for all the other structs we define as well.
Life Line
I think this was my favourite photo of the set that I took. It's not at maximum coverage, but it does have a sun spot group (4508) just on the cusp of the terminator.
#eclipse #eclipse2026 #SolarEclipse #London #Astronomy #AstroPhotography #Photography
No totality here in London, but still had a great evening out in the local park and taking some snaps.
I did have a nice Solar Filter that I made for my lens, and had many conversations with people from different backgrounds. Kids loves to look through my filter after I was done (ran out of battery power).
More photos later...
I walked 0.9km in 9m28s
I walked 1.2km in 19m05s
Merged pull request #1100
Fixed issue #2267: Application slow when debugger is not listening on…
I walked 4.7km in 48m18s
I walked 3.0km in 1h10m24s
Is there somebody who runs PHP on native windows (with Xdebug) and can run a simple script for me?
It must be in a file (`test.php`):
```
<?php
echo microtime(true), "\n";
xdebug_connect_to_client();
echo microtime(true), "\n";
```And run like:
php -dxdebug.log_level=11 -dxdebug.log=c:\temp\xdebug-i.log -dxdebug.client_host=localhost -dxdebug.client_port=9111 -dxdebug.mode=debug c:\temp\test.php
With the port 9111 not open.
Would love to see the output and log file (in a DM).
I walked 5.5km in 55m06s
@harry_wood This is this list of 100 Go-mistakes that I was talking about: https://100go.co/
Updated a crossing
I walked 2.1km in 20m08s
Enjoying my afternoon and evening out at Lords for some cricket!
I walked 3.2km in 38m54s
I walked 9.1km in 1h34m28s
Updated a gate
Updated a bakery shop
Updated a convenience shop
I walked 8.1km in 1h32m18s
I walked 5.6km in 59m13s
Updated a restaurant and a cafe; Confirmed 2 restaurants and a cafe
I walked 6.7km in 1h8m27s
I walked 4.7km in 50m02s
I got myself a sheet of Sun-safe filter material, and McGuyvered a pop-up filter for my lens.
The first attempt sort of worked, but I didn't get the filter 100% straight. Luckily I have more material.
But this is sort of my first attempt, and a few sunspots are clearly visible on the right of the image.
Warning: Never look at the Sun without protection!





Shortlink
This article has a short URL available: https://drck.me/adv1304-aet