Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Code, notes ], Updated struct padding concepts #10

Merged
merged 3 commits into from
Feb 11, 2025
Merged

Conversation

M0hanrajp
Copy link
Owner

Summary of struct-Padding concepts

  • Added struct padding examples: Introduced four different struct memory layouts to illustrate how struct padding works and its impact on memory alignment.
  • Updated struct padding notes: Improved documentation with additional explanations or refinements.
  • Deleted workflows: Removed workflow files, possibly for repository cleanup or restructuring.

Further structure padding on nested structures and array of structures need to be studied.

* Has 4 differnet struct memory layout
* Gives basic understanding of how struct padding is performed.
@M0hanrajp M0hanrajp added the documentation Improvements or additions to documentation label Feb 11, 2025
@M0hanrajp M0hanrajp self-assigned this Feb 11, 2025
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check-spelling found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

Unrecognized words (704)
aaaaa
aaaaaddddr
aaabbbbhaijjjm
aaac
aaaxbbbbyyhwawiwjjjwwm
aab
aabacbaa
aac
aae
aafec
aarr
AATG
abbd
ABCABC
abcd
abcdefghijklm
abdx
acb
acbac
acceleratingscience
acde
acess
acf
ACGTGGTCTTAA
acm
ACSKLDFJSg
ACSKLDFJSGSKLDFJSKLDFJ
adada
adde
adderss
addl
addressof
aebd
aec
aef
afc
afe
afs
AGGACGGATTCT
AGTG
allcoation
alligned
allignemnt
allignment
alloca
allocs
alph
amd
anotherlin
anton
Anual
APLHABETS
appened
argumemt
arp
Arra
ASan
ASANFLAGS
asd
aspnes
aspx
atleast
ato
ATTGC
avr
aydoganersoz
BACD
balapriyac
bascis
bbabcabb
bbb
BBBB
bca
bcc
bdc
bdfc
becuase
begineer
benkelaar
bfa
Bfd
bfdfd
bfdfda
bfdfdb
Bhogdq
Bifk
bioinformatics
bler
Bli
bmi
Bohdan
bootcamp
buf
Bzdrzq
calculater
calloc
caluclated
CATA
CATCGTAATGACGGCCT
ccc
ccfbb
cde
cdna
cdot
cea
Ceedling
cfb
CFLAGS
charcode
chipy
chl
choosen
chppy
chris
chrono
Churchgate
circularshift
Clane
clc
cleancoder
clooney
CMOCK
cmp
cmu
codecuts
coderanch
codewars
codewithc
colindex
collatz
Comapre
compelte
computermouth
concat
confrimed
consdier
consideres
conti
conver
Corssing
counta
countb
countd
cplusplus
cppreference
cprogramming
cpy
crr
crt
csu
ctype
cubiod
customfunc
Cwl
dbc
Dbftbs
Dbu
dcd
dcffc
ddd
Dddd
deathsec
decalaration
decalred
decesending
declaraing
declaraiton
defc
definiion
definiton
demonstartion
deno
deodrant
dervice
desried
devdocs
dfd
dfff
DGAKIXv
differenet
diigts
Dimesion
disarium
disemvowel
disemvowell
dispay
distnace
diveintosystems
Djqifs
dlrow
dna
doolittle
drr
dsa
DUNITY
earfcn
eax
ebced
ece
eda
ede
edu
eee
Eeee
eeefada
efeb
eip
elemetns
elif
eliza
Ello
elyashiv
empcode
empname
empoloyee
encryptor
Endianess
endianness
erso
esi
eturn
evex
EWa
exectue
exercism
expd
expresion
Ezty
fadd
faqs
Favuzzi
fbb
fbc
fbd
Fbs
Feenan
feeney
fef
ffb
ffc
ffd
ffe
ffec
fff
fffa
fffaraz
ffff
ffffffde
fffffffdc
fffffffddb
fffffffde
fffffffdef
fffffffdefc
fffffffdf
fffffffdfb
fffffffe
ffffffff
FFFFFFFFFFFFFFFF
fflush
fibonacci
finduniq
firstname
flaga
flagb
flagc
fnbf
fno
forumula
fptr
fragglet
freecodecamp
fres
fsaadatmand
fsanitize
fucntion
Funciotn
funciton
FVA
fverbose
fwait
GAGCCTACTAACGGGAT
garbadge
gblog
GCAT
GCAU
gcc
gdb
gdbgui
gea
Geeksfor
geeksforgeeks
genrealization
getchar
gettime
gfg
GGACGGATTCTG
GGACTGAAATCTG
GIGAOHMS
gigday
gimj
glovebox
gmtime
GNUC
grea
gsu
GTAT
Guntau
GXz
hamm
handover
hanrajp
hbase
hexdump
HHeelllloo
hintjens
hiphen
holiding
htb
hurchgate
IAR
ifdef
ifndef
iic
imj
immuatable
imul
incerment
initialzing
Inititally
inp
intptr
ints
inttypes
ioc
iphone
ippy
ischanged
isinf
isnan
isogrammic
isup
itoa
jaden
jappingly
javascript
jayeshcp
jmp
JPizzle
JTC
jumanji
jwasham
Karlesky
kata
keiravillekode
kiloohms
kiloseconds
kinfe
kspalaiologos
kth
kunal
kushwaha
kytrinyx
laptopdb
lario
layot
ldots
Leigon
len
Lenovo
lhs
libc
libexec
libthread
lifecycle
Liga
lightsabers
linux
linuxhint
Ljnux
llo
lmylibrary
lnext
LOL
longjmp
longstring
loquen
lovefunc
lpil
lptr
LSBs
lsrs
lte
LTERNATINGc
makefiles
malloc
marky
maskify
mathsisfun
mathworld
matrixmultiplication
MEGAOHMS
megaseconds
memcheck
memcpy
memeory
memset
Mendieta
mentoring
messi
microsoft
Mikkelsen
modifyable
Mohanraj
mpunix
msb
msbflag
mth
muigi
Mulitple
multiarch
multiline
Mumbai
myfunctions
mylove
naddress
Nananananananananananananananana
Nasm
nesdoug
nfive
nfour
nnn
NObp
nop
noreturn
nprints
nptl
nromal
nsize
nsizeof
NSTIV
nums
nwhat
obidos
objfile
occurences
occuring
occurrance
occurrs
ocw
omplete
onlinedocs
ooc
oox
ooxx
opeartor
openssl
Orld
ountr
outp
overalp
overalpping
overrideable
Pakku
pangram
Paolera
paranthesis
particualar
patricksjackson
pch
pdf
perror
pgmspace
phnum
phy
planetpdf
porcessed
portfoliocourses
prntf
PROGMEM
projecteuler
protoype
ptr
ptrf
putchar
QLaille
Qpa
racecar
Ramen
Ramesh
rcx
realloc
reate
receving
recieve
redzone
refering
reffered
reigon
Remeber
resa
resb
returs
retval
RGk
rhs
rna
rnai
rodata
rootbeersoup
Rqa
rrna
rsrp
rsrq
rubykoans
rwxp
ryanplusplus
saminiir
sanfoundry
sbb
scanf
Schierboom
Schwartzkopf
segemenatation
segementation
segfault
segmetation
servername
sesamemucho
Setbit
setjmp
shifiting
shm
shortstring
showcerts
siebenschlaefer
SIGSEGV
simluate
simluation
sinr
sjwarner
SKLDFJSKLDFJ
snprintf
soruce
sourceware
sprintf
sptr
Sqaure
sqn
SRCREF
SSttrriinngg
stackoverflow
stdarg
stdbool
STDC
stddef
stdint
stdio
stdlib
strb
strc
strcat
strcmp
strcpy
strcut
strftime
strin
stringfunc
strlen
strncmp
stro
strrev
strtheing
STRTOINT
structa
structb
structc
structd
structe
structrue
structs
studytonight
subarray
subdermatoglyphic
successfull
successfuly
sumpd
sunzenshen
Suresh
swapcontext
Swapp
swtich
sysdeps
sysprog
TAACG
taylor
tcp
tcpl
tdd
tempa
tempb
tempc
tempd
tempf
testname
thenewboston
Ths
timespec
tirangle
tls
tmp
tobor
tolower
toupper
trianlge
tribonacci
TRING
TRj
Tttt
Tttttt
tutorialspoint
twod
typedef
ues
UGCACCAGAAUU
uint
UINTPTR
ULONG
Umake
upto
usr
utc
UTF
utm
valgrind
vdso
vernor
vertice
vfork
vfprintf
vgpreload
VIMP
vinge
Vitorvgc
Vlcjyymq
vlzware
Voord
Vooza
vvar
wbst
Wdiv
webmonkeys
website
Werror
Wextra
Wformat
whatday
whatis
Whenn
whitespaces
wikipedia
wil
Wincompatible
witherspoon
Wmain
Wmissing
wolframalpha
Wparentheses
Wpointer
Wreturn
Wstring
Wstringop
Wuninitialized
WWoorrlldd
wwwwwwz
xaa
xaddress
xcb
xdc
xdd
xff
xfff
xffff
xng
xooxx
xor
xxd
yakults
yeild
yoda
yodaest
Yorkie
youtu
youtube
ypk
yrgnuh
yun
Yyyyyyy
Zaphod
zdqmwpbs
zpzpzpp
zzoo
zzyzx
zzzzs
Zzzzz
Some files were automatically ignored 🙈

These sample patterns would exclude them:

(?:^|/)insertionSort$
(?:^|/)selectionSort$
[^/]\.out$
^\Qcodewars/7KYU/shortest_word.c\E$
^\Qcompilation_process/steps-main.i\E$
^\Qmemory_leaks/library_program/library.c\E$
^\Qprogramming_concepts/arrays/practice/gfg/quick_sort/main.c\E$
^compilation_process/steps$
^memory_leaks/concatenating_strings/concatenating_strings$
^memory_leaks/contacts_programs/contact_list$
^memory_leaks/copy_string_array/copy_string_array$
^memory_leaks/dynamic_integer_array/dynamic_integer_array$
^memory_leaks/dynamic_string_array/dynamic_string_array$
^memory_leaks/grade_management/grade_management$
^memory_leaks/LTE-NR_cell_load_analysis/cell_load$
^memory_leaks/LTE-NR_handover_sim/handover_sim$
^memory_leaks/LTE-NR_neighbor_cell/neighbor_cell$
^memory_leaks/LTE-NR_throughput_calculation/throughput_calculation$
^memory_leaks/LTE-NR_UE_information_processing/ue_info$
^memory_leaks/resizing_dynamic_array/resizing_dynamic__array$
^programming_concepts/arrays/array_basic_compelte$
^programming_concepts/arrays/merge_sort/merge_sort$
^programming_concepts/arrays/multi_dimensional_array/2D_array$
^programming_concepts/arrays/multi_dimensional_array/2D_array_function$
^programming_concepts/arrays/multi_dimensional_array/2D_array_pointers_local$
^programming_concepts/arrays/multi_dimensional_array/2D_array_pointers_main$
^programming_concepts/arrays/multi_dimensional_array/3D_array$
^programming_concepts/arrays/practice/gfg/average_elements/average_elements$
^programming_concepts/arrays/practice/gfg/binary_search/binary_search$
^programming_concepts/arrays/practice/gfg/binary_search/bs$
^programming_concepts/arrays/practice/gfg/bubble_sort/bubble_sort$
^programming_concepts/arrays/practice/gfg/common_array_elements/common_array_elements$
^programming_concepts/arrays/practice/gfg/descending_order/selection_sort$
^programming_concepts/arrays/practice/gfg/linear_search/linearSearch$
^programming_concepts/arrays/practice/gfg/merge_array/merge_array$
^programming_concepts/arrays/practice/gfg/practice/bubbleSort$
^programming_concepts/arrays/practice/problems/problem_a$
^programming_concepts/arrays/practice/problems/problem_c$
^programming_concepts/arrays/refer_passing_array_function$
^programming_concepts/arrays/return_array_function$
^programming_concepts/breakContinue_swtich_statement/switch$
^programming_concepts/datatype_storage/storage$
^programming_concepts/for_statement/app_for$
^programming_concepts/if_else/main$
^programming_concepts/pointers/practice/dr/basics$
^programming_concepts/structs/practice/lte_phy_simulation/lte_phy_sim$
^programming_concepts/structs/practice/ypk_problems/problem_b/bank_application$
^programming_concepts/structs/practice/ypk_problems/problem_e/employee_database$
^programming_concepts/structs/practice/ypk_problems/problem_match/practice$
^programming_concepts/while_statement/characters_print/app_print_char$
^programming_concepts/while_statement/valentine/mylove$
^programming_concepts/while_statement/while$

You should consider excluding directory paths (e.g. (?:^|/)vendor/), filenames (e.g. (?:^|/)yarn\.lock$), or file extensions (e.g. \.gz$)

You should consider adding them to:

.github/actions/spelling/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To use the spell-check-this repository, accept these unrecognized words as correct, and update file exclusions, you could run the following commands

... in a clone of the [email protected]:M0hanrajp/c-programming.git repository
on the struct-padding branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/M0hanrajp/c-programming/actions/runs/13269281102/attempts/1'

OR

To have the bot accept them for you, comment in the PR quoting the following line:
@check-spelling-bot apply updates.

Available 📚 dictionaries could cover words not in the 📘 dictionary
Dictionary Entries Covers Uniquely
cspell:cpp/src/stdlib-c.txt 278 30 8
cspell:php/dict/php.txt 1689 24 4
cspell:java/src/java.txt 2464 9 3
cspell:python/src/common/extra.txt 741 7 3
cspell:filetypes/filetypes.txt 264 6 3

Consider adding them (in .github/workflows/main.yml) in jobs:/spelling: for uses: check-spelling/check-spelling@main in its with:

      with:
        extra_dictionaries: |
          cspell:cpp/src/stdlib-c.txt
          cspell:php/dict/php.txt
          cspell:java/src/java.txt
          cspell:python/src/common/extra.txt
          cspell:filetypes/filetypes.txt

To stop checking additional dictionaries, add (in .github/workflows/main.yml) for uses: check-spelling/check-spelling@main in its with:

check_extra_dictionaries: ''
Forbidden patterns 🙅 (6)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Do not use (click) here links

For more information, see:

(?i)(?:>|\[)(?:(?:click |)here|link|(?:read |)more)(?:</|\]\()

Should be case-(in)sensitive

\bcase (?:in|)sensitive\b

In English, duplicated words are generally mistakes

There are a few exceptions (e.g. "that that").
If the highlighted doubled word pair is in:

  • code, write a pattern to mask it.
  • prose, have someone read the English before you dismiss this error.
\s([A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})\s\g{-1}\s

Should only be one of a, an, or the

\b(?:(?:an?|the)\s+){2,}\b

Should be GitHub

(?<![&*.]|// |\b(?:from|import|type) )\bGithub\b(?![{()])

Should be JavaScript

\bJavascript\b
Pattern suggestions ✂️ (24)

You could add these patterns to .github/actions/spelling/patterns.txt:

# Automatically suggested patterns

# hit-count: 716 file-count: 34
# hex digits including css/html color classes:
(?:[\\0][xX]|\\u|[uU]\+|#x?|%23|&H)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|[iu]\d+)\b

# hit-count: 703 file-count: 122
# base64 encoded content
([`'"])[-a-zA-Z=;:/0-9+]{3,}=?\g{-1}

# hit-count: 547 file-count: 335
# #includes
^\s*#include\s*(?:<.*?>|".*?")

# hit-count: 358 file-count: 101
# https/http/file urls
(?:\b(?:https?|ftp|file)://)[-A-Za-z0-9+&@#/*%?=~_|!:,.;]+[-A-Za-z0-9+&@#/*%=~_|]

# hit-count: 202 file-count: 26
# Compiler flags (Unix, Java/Scala)
# Use if you have things like `-Pdocker` and want to treat them as `docker`
(?:^|[\t ,>"'`=(])-(?:(?:J-|)[DPWXY]|[Llf])(?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})

# hit-count: 202 file-count: 26
# Compiler flags (Windows / PowerShell)
# This is a subset of the more general compiler flags pattern.
# It avoids matching `-Path` to prevent it from being treated as `ath`
(?:^|[\t ,"'`=(])-(?:[DPL](?=[A-Z]{2,})|[WXYlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,}))

# hit-count: 160 file-count: 20
# ANSI color codes
(?:\\(?:u00|x)1[Bb]|\\03[1-7]|\x1b|\\u\{1[Bb]\})\[\d+(?:;\d+)*m

# hit-count: 56 file-count: 22
# GitHub SHAs (markdown)
(?:\[`?[0-9a-f]+`?\]\(https:/|)/(?:www\.|)github\.com(?:/[^/\s"]+){2,}(?:/[^/\s")]+)(?:[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|)

# hit-count: 37 file-count: 31
# hex runs
\b[0-9a-fA-F]{16,}\b

# hit-count: 27 file-count: 7
# libraries
(?:\b|_)lib(?:re(?=office)|)(?!era[lt]|ero|erty|rar(?:i(?:an|es)|y))(?=[a-z])

# hit-count: 22 file-count: 19
# Wikipedia
\ben\.wikipedia\.org/wiki/[-\w%.#]+

# hit-count: 20 file-count: 20
# stackexchange -- https://stackexchange.com/feeds/sites
\b(?:askubuntu|serverfault|stack(?:exchange|overflow)|superuser).com/(?:questions/\w+/[-\w]+|a/)

# hit-count: 12 file-count: 6
# uuid:
\b[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\b

# hit-count: 8 file-count: 5
# in [email protected]+, printf markers aren't automatically consumed
# printf markers
(?<!\\)\\[nrt](?=[a-z]{2,})

# hit-count: 8 file-count: 5
# alternate printf markers if you run into latex and friends
(?<!\\)\\[nrt](?=[a-z]{2,})(?=.*['"`])

# hit-count: 6 file-count: 5
# While you could try to match `http://` and `https://` by using `s?` in `https?://`, sometimes there
# YouTube url
\b(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|user/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_%]*

# hit-count: 4 file-count: 4
# Internet Archive
\barchive\.org/web/\d+/(?:[-\w.?,'/\\+&%$#_:]*)

# hit-count: 2 file-count: 2
# freecodecamp.org
\bfreecodecamp\.org/[-\w/.]+

# hit-count: 2 file-count: 2
# version suffix <word>v#
(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_]))

# hit-count: 2 file-count: 1
# latex (check-spelling >= 0.0.22)
\\\w{2,}\{

# hit-count: 2 file-count: 1
# Markdown anchor links
\(#\S*?[a-zA-Z]\S*?\)

# hit-count: 1 file-count: 1
# Amazon
\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|)

# hit-count: 1 file-count: 1
# microsoft
\b(?:https?://|)(?:(?:(?:blogs|download\.visualstudio|docs|msdn2?|research)\.|)microsoft|blogs\.msdn)\.co(?:m|\.\w\w)/[-_a-zA-Z0-9()=./%]*

# hit-count: 1 file-count: 1
# base64 encoded content, possibly wrapped in mime
(?:^|[\s=;:?])[-a-zA-Z=;:/0-9+]{50,}(?:[\s=;:?]|$)

Errors (5)

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
⚠️ binary-file 116
ℹ️ candidate-pattern 60
❌ check-file-path 692
❌ forbidden-pattern 16
⚠️ noisy-file 1

See ❌ Event descriptions for more information.

Copy link
Owner Author

@M0hanrajp M0hanrajp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, ignore the spell checker.

@M0hanrajp M0hanrajp merged commit faaada1 into master Feb 11, 2025
3 of 5 checks passed
@M0hanrajp M0hanrajp deleted the struct-padding branch February 11, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant