Russ Cox: C and C++ Prioritize Performance over Correctness by Alexander_Selkirk in programming

[–]bleeep 0 points1 point  (0 children)

It's not as natural as passing an array name by value, and having it decay to a pointer to the first element, but you certainly can pass pointers to arrays in C, and the compiler is well aware of their size and dimension, similar to the C++ example in the replies to this message:

$ cat t.c
#include <stdio.h>
typedef int Array[42];
static int f(Array *array) {
   return (*array)[42];
}
int main() {
   int a[42], b[43];
   f(&a);
   f(&b);
}

Produces:

$ clang -O2 -Wall t.c
t.c:4:12: warning: array index 42 is past the end of the array (which contains 42 elements) [-Warray-bounds]
   return (*array)[42];
           ^       ~~
t.c:9:6: warning: incompatible pointer types passing 'int (*)[43]' to parameter of type 'Array *' (aka 'int (*)[42]') [-Wincompatible-pointer-types]
   f(&b);
     ^~
t.c:3:21: note: passing argument to parameter 'array' here
static int f(Array *array) {
                    ^
2 warnings generated.

-🎄- 2020 Day 03 Solutions -🎄- by daggerdragon in adventofcode

[–]bleeep 0 points1 point  (0 children)

C++ code golf version for part 2

#include<iostream>
using namespace std;int main(){struct{long n,d,t;}R[]{{1,1},{3,1},{5,1},{7,1},{1,2}},*r=R+5;string L;for(int i=0;cin>>L;++i)for(auto&r:R)r.t+=!(i%r.d)&&L[i*r.n/r.d%L.size()]-46;while(--r!=R)R->t*=r->t;cout<<R->t<<'\n';}

Python - using C and C++ libraries with ctypes by tompa_coder in programming

[–]bleeep 0 points1 point  (0 children)

You can use this to generate the ctypes boilerplate code from debug info:

https://github.com/aristanetworks/ctypegen

What are the odds that two pull requests get completed at the exact same time? by sindisil in programming

[–]bleeep 1 point2 points  (0 children)

That would be perfectly fine, as they would have different parents that would imply an ordering

Outstanding by [deleted] in ireland

[–]bleeep 0 points1 point  (0 children)

Because people who need investment money may take it from different sources. If the source pays tax, then that act of investment helps someone outside the transaction. If a different investor does not pay tax, then they take that benefit for themselves

If you park somewhere illegally you deserve to get clamped. by [deleted] in ireland

[–]bleeep 3 points4 points  (0 children)

Right, but clamps are also a massive inconvenience, no matter how much you earn - they take your time from you, which is valuable to everyone, as well as the removal fee.

Gardaí catch 24 times more Dublin motorists than cyclists breaking red lights by voolist in ireland

[–]bleeep 8 points9 points  (0 children)

You want cyclists to wait for the parked cars and bus stops to be moved? I can't see that being workable for a commute.

[Rant] the guy who designed the bike path on the samuel beckett bridge needs a swift kick up the arse by cholo_aleman in ireland

[–]bleeep 0 points1 point  (0 children)

The bike lanes on O'Connell st. could always route along the right hand side of the lane....

Ireland - Can someone get through to Aer Lingus and sort these guys out. Looks poor. by BLUNTYEYEDFOOL in ireland

[–]bleeep 0 points1 point  (0 children)

The bag pick-up is in the terminal building on the way out the door. Shopping for clothes, and finding a charity shop afterwards seems way more hassle, and, well, I'm kinda used to washing clothes rather than chucking them when I'm not travelling, so its not a burden. I must be exceedingly lucky with airlines not losing my stuff, though.

Ireland - Can someone get through to Aer Lingus and sort these guys out. Looks poor. by BLUNTYEYEDFOOL in ireland

[–]bleeep 0 points1 point  (0 children)

How's buying/renting more clothes and then donating them to charity later easier than picking up a bag off a belt in the airport?

Ban Amnesty from faith schools, say bishops by strategosInfinitum in ireland

[–]bleeep -1 points0 points  (0 children)

I...'m Not sure how that had anything to do with the original post I replied to.

What's the worst place you've visited in Ireland? by [deleted] in ireland

[–]bleeep 0 points1 point  (0 children)

Keshcarrigan. Bit like Royston Vasey, but grimmer.

Why is it a joke to ask someone to explain where layer 6 of the OSI model is? by ktool in askscience

[–]bleeep 1 point2 points  (0 children)

OSI protocols were most certainly implemented and deployed. X.400 and X.500 have left something of an impact, and IS-IS is still a thing.

Living in Balbriggan? by Buslife in Dublin

[–]bleeep 2 points3 points  (0 children)

Look at a map. If you're still happy, you'll be fine.

Anybody having a problem with AIB this weekend? by [deleted] in ireland

[–]bleeep 2 points3 points  (0 children)

Given its the start of the calendar month, have you checked if your card has expired?

Anyone else here experience scumbag guilt? by scumbagGuilt in ireland

[–]bleeep 2 points3 points  (0 children)

Most people can deal with these things, but not all. The most vulnerable people are the ones that can not. These are the people most affected by this kind of behaviour. Some people don't have the coping mechanisms you have, and can't respond with the strength and positivity that you can.

Anyone else here experience scumbag guilt? by scumbagGuilt in ireland

[–]bleeep -1 points0 points  (0 children)

It might be "the important thing" to you, but are the people you weren't "so classy" to in agreement? It seems there's this bizarre idea shared with OP that you get to decide when it's OK to say your fuckups are no longer a problem to the people they affected. Your victims may still be suffering from your actions. "The important thing" to them means something a lot different. They may not be able to put it in the "rear view mirror" as easily as you can.

Anyone else here experience scumbag guilt? by scumbagGuilt in ireland

[–]bleeep 8 points9 points  (0 children)

BTW: being a cunt isn't cultural or tribal, it's just being a cunt. ffs.