Sinisterly
Show Off Your Work - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Show Off Your Work (/Thread-Show-Off-Your-Work)

Pages: 1 2 3


RE: Show Off Your Work - Oni - 11-07-2016

(11-07-2016, 05:28 AM)DarkMuse Wrote:
(10-25-2016, 06:21 PM)Pikami Wrote: My favorite language is C++
This is my work:


It's a PSP homebrew that when plugged in to the computer it acts as a keyboard.
Got this idea from the USB rubber ducky.

Probably all a PSP is good for anymore lmao

Some of the games are still considered great. I've got a Vita now, but still use the original from time to time.


RE: Show Off Your Work - Pikami - 11-07-2016

(11-07-2016, 05:28 AM)DarkMuse Wrote: Probably all a PSP is good for anymore lmao

I still play games on it, it has lots of emulators, so I can play games from gameboy, PS, etc.
It is my first and only console.


RE: Show Off Your Work - bitm0de - 11-29-2016

(10-16-2016, 08:01 AM)phyrrus9 Wrote: Favorite language: ARM (32 bit + Thumb2)
Most used language: C

If you really want to see some of the hideous personal projects I've done, have a look at my github
this one is pretty interesting since my knowledge of networking is rather lacking.

https://github.com/phyrrus9/dns/blob/master/dns.c#L158

^ breaks strict aliasing rules. Lots of heap usage and malloc calls that can be allocated on stack too.


RE: Show Off Your Work - phyrrus9 - 11-30-2016

(11-29-2016, 07:55 AM)bitm0de Wrote:
(10-16-2016, 08:01 AM)phyrrus9 Wrote: Favorite language: ARM (32 bit + Thumb2)
Most used language: C

If you really want to see some of the hideous personal projects I've done, have a look at my github
this one is pretty interesting since my knowledge of networking is rather lacking.

https://github.com/phyrrus9/dns/blob/master/dns.c#L158

^ breaks strict aliasing rules. Lots of heap usage and malloc calls that can be allocated on stack too.

I had a college professor once say (relating to an entirely different subject) "once you know the rules and understand why they are there, you will understand when and how it is ok to break them".

A lot of the code I write breaks modern ANSI rules, but I frequently use little hacks in place of research to get something done quickly. As for this particular scenario, I couldn't remember off the top of my head the correct shift values, and didn't want to deal with endianness, so I just pulled it out of unaligned memory. Most of the projects on my github are personal projects I've done either to learn something new (in this case, a little about how the DNS protocol works) or flex a skill I already have. It's highly unlikely you would see code this disorganized, undocumented, and hacky in any of my contracted projects.


RE: Show Off Your Work - Zaiken - 11-30-2016

Would love to show some code i did but i lost everything a while back and never code anymore so yh.


RE: Show Off Your Work - bitm0de - 11-30-2016

(11-30-2016, 08:06 PM)phyrrus9 Wrote:
(11-29-2016, 07:55 AM)bitm0de Wrote:
(10-16-2016, 08:01 AM)phyrrus9 Wrote: Favorite language: ARM (32 bit + Thumb2)
Most used language: C

If you really want to see some of the hideous personal projects I've done, have a look at my github
this one is pretty interesting since my knowledge of networking is rather lacking.

https://github.com/phyrrus9/dns/blob/master/dns.c#L158

^ breaks strict aliasing rules. Lots of heap usage and malloc calls that can be allocated on stack too.

I had a college professor once say (relating to an entirely different subject) "once you know the rules and understand why they are there, you will understand when and how it is ok to break them".

A lot of the code I write breaks modern ANSI rules, but I frequently use little hacks in place of research to get something done quickly. As for this particular scenario, I couldn't remember off the top of my head the correct shift values, and didn't want to deal with endianness, so I just pulled it out of unaligned memory. Most of the projects on my github are personal projects I've done either to learn something new (in this case, a little about how the DNS protocol works) or flex a skill I already have. It's highly unlikely you would see code this disorganized, undocumented, and hacky in any of my contracted projects.

I think you're talking about alignment not strict aliasing. I'm referring to uint8_t * to int * casting.


RE: Show Off Your Work - phyrrus9 - 11-30-2016

(11-30-2016, 10:13 PM)bitm0de Wrote:
(11-30-2016, 08:06 PM)phyrrus9 Wrote:
(11-29-2016, 07:55 AM)bitm0de Wrote: https://github.com/phyrrus9/dns/blob/master/dns.c#L158

^ breaks strict aliasing rules. Lots of heap usage and malloc calls that can be allocated on stack too.

I had a college professor once say (relating to an entirely different subject) "once you know the rules and understand why they are there, you will understand when and how it is ok to break them".

A lot of the code I write breaks modern ANSI rules, but I frequently use little hacks in place of research to get something done quickly. As for this particular scenario, I couldn't remember off the top of my head the correct shift values, and didn't want to deal with endianness, so I just pulled it out of unaligned memory. Most of the projects on my github are personal projects I've done either to learn something new (in this case, a little about how the DNS protocol works) or flex a skill I already have. It's highly unlikely you would see code this disorganized, undocumented, and hacky in any of my contracted projects.

I think you're talking about alignment not strict aliasing. I'm referring to uint8_t * to int * casting.

True, that could be a problem in certain areas, though not here. Considering it will only ever hit memory within my zone, I'm not worried. Also, you used uint8 like that u matters... as far as memory accesses go, uint8_t and int8_t are the same thing. only difference is interpretation, which once again matters none here.


RE: Show Off Your Work - bitm0de - 11-30-2016

(11-30-2016, 10:16 PM)phyrrus9 Wrote:
(11-30-2016, 10:13 PM)bitm0de Wrote:
(11-30-2016, 08:06 PM)phyrrus9 Wrote: I had a college professor once say (relating to an entirely different subject) "once you know the rules and understand why they are there, you will understand when and how it is ok to break them".

A lot of the code I write breaks modern ANSI rules, but I frequently use little hacks in place of research to get something done quickly. As for this particular scenario, I couldn't remember off the top of my head the correct shift values, and didn't want to deal with endianness, so I just pulled it out of unaligned memory. Most of the projects on my github are personal projects I've done either to learn something new (in this case, a little about how the DNS protocol works) or flex a skill I already have. It's highly unlikely you would see code this disorganized, undocumented, and hacky in any of my contracted projects.

I think you're talking about alignment not strict aliasing. I'm referring to uint8_t * to int * casting.

True, that could be a problem in certain areas, though not here. Considering it will only ever hit memory within my zone, I'm not worried. Also, you used uint8 like that u matters... as far as memory accesses go, uint8_t and int8_t are the same thing. only difference is interpretation, which once again matters none here.

Dereferencing a pointer that aliases another of an incompatible type is undefined behavior as it's a violation of strict aliasing rules. It is definitely still a problem.

My emphasis wasn't on signed vs. unsigned, that is an assumption on your behalf, it was on the incompatible types by ISO C standard. uint8_t/int8_t may be compatible, but you used int and uint8_t. Your code breaks strict aliasing rules and allows for adjecent memory in relation to where that uint8_t sits to be overwritten with that scanf() call; because you're using int * to point to a uint8_t *.