[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


What are you maids working on?

Last one: >>108561805
>>
>>108582544
>>108561805 (OP)
Next thread:
>>108582544
>>108582544
>>108582544
>>
>>108582544
working to automate the setup of my new computer (checking in all my dotfiles into git, package installation scripts, etc.) so that i never have to fuck with this again
>>
Thank you maid-sama.
(I don't know what that means)
>>
>>108582544
You should all learn to vibecode
>>
>You should all learn to make yourself a useless, dependent brainlet
>>
making another library/manga downloader like everyone else except it supports plugins

kinda complex on the design part to get it right. and I still don't know if it is

Also I added in api too so you can easily intergrate it with whatever
>>
>>108582779
There’s nothing wrong with using new tech, Luddite
>>
File: 1603861915977.jpg (11 KB, 207x236)
11 KB
11 KB JPG
>>108582475
This code compiles, but gives the following warning:
test.c: In function ‘f’:
test.c:4:26: warning: ‘sizeof’ on array function parameter ‘a’ will return size of ‘int *’ [-Wsizeof-array-argument]
4 | size_t s = sizeof(a);
| ^
test.c:3:12: note: declared here
3 | void f(int a[], char *id) {
| ~~~~^~~

And when I try to run it I get a segmentation fault.

I don't understand what are you trying to accomplish, you're declaring a variable s in f, but this variable is popped from the stack when the function exits so f(arr1, "arr1") should do nothing, and p() is trying to print the uninitialized pointer *id, so it gets a segfault because it's trying to access a pointer with a garbage address that probably points outside the program.

>>108582516
So what is best practice? For example, If I have a string, should I declare it as a pointer or an array?
char s[] = "Hello World";
char* s = "Hello World";

Is there any practical difference?
>>
File: 1750897030742208.png (110 KB, 1434x825)
110 KB
110 KB PNG
>>108582829
also do the icons look ok? I'm actually using drawn SVG paths and not images, thinking they don't look as sharp and have a thick look
>>
>>108582836
if you need the compile-time constant length of the string, use the array. otherwise, use the pointer
>>
>>108582764
Who's gonna buy it if anyone can create it themselves?
>>
>>108582915
You have to understand that the ""profession"" of codetrans is over.
Face it, it’s a useless skill
>>
>>108582764
I use it regularly for fitting tasks, for example rewriting this:

```rust
mod get_entity_mesh_data;
mod get_entity_mesh;
mod get_entity_aabb;
mod get_entity_material;
mod get_entity_name;
mod children_query_ext;

pub use get_entity_mesh_data::*;
pub use get_entity_mesh::*;
pub use get_entity_aabb::*;
pub use get_entity_material::*;
pub use get_entity_name::*;
pub use children_query_ext::*;
```

into this:

```rust
mod get_entity_mesh_data;
pub use get_entity_mesh_data::*;

mod get_entity_mesh;
pub use get_entity_mesh::*;

mod get_entity_aabb;
pub use get_entity_aabb::*;

mod get_entity_material;
pub use get_entity_material::*;

mod get_entity_name;
pub use get_entity_name::*;

mod children_query_ext;
pub use children_query_ext::*;
```
>>
rfid reader with Raspi.
Redpill me into stop procrastinating.
>>
>>108582836
> char s[] = "Hello World";
> char* s = "Hello World";
Those are actually the same, they're both pointers to string in static memory.
Just remember that arrays with fixed length are special.
Neither of those is array with fixed length.
>>
>>108582958
>Neither of those is array with fixed length.
If I wrote 12 (number of characters in "Hello World" plus null terminator) inside the array bracket would it be different?
>>
>>108582836
C does not have arrays at runtime. Arrays in C are purely a compile-time thing and, when you understand this, you'll see through the stupid nonsense of "C arrays" and "C strings". Neither such things exist after compile time in the language's semantics.
Stop thinking about the "decay" nonsense because it provides a strictly incorrect framework. Think of arrays and strings in C as a compile-time convention to provide the compiler information as to how to memory should be laid out. Once compiled, they *do not exist*. You only have pointers to that memory which the compiler laid out.
>>
File: Heart hands.gif (796 KB, 640x360)
796 KB
796 KB GIF
>>108582750
>>
>>108582832
That's correct.
AI can be helpful in certain areas. Relying on it is stupid. Fighting against it is stupid too, because it's getting pushed to hard by THEM anyways.
So yeah, AI is okay-ish. Vibing is retard brainlet shit
>>
File: 1775461997322061.png (276 KB, 520x600)
276 KB
276 KB PNG
>luddite
>>
>>108582943
nice blog post. Upvoted
>>
>>108583015
Yes, print sizeof in both cases.
>>
File: 1775821479503769.jpg (375 KB, 1200x1000)
375 KB
375 KB JPG
>>108582475
>>108582836
Some static checking of array parameters is possible by adding the size
void f(int x[4])
{
return;
}

int x[] = {1, 2, 3};
f(x);

warning: ‘f’ accessing 16 bytes in a region of size 12
7 | f(x);
| ^~~~
note: referencing argument 1 of type ‘int[4]’
note: in a call to function ‘f’
1 | void f(int x[4])
| ^
>>
>>108582764
Unfortunately AI cant solve my problems
>>
>>108582958
The first will have a sizeof of the length of the array, and the second will have a sizeof of the size of a pointer. Though that only applies so long as you don't pass it into a function.
>>
>wojak
>>
Why didn't C do this:

void wat(int arr[]) {
sizeof(arr) == 10
}
void wot() {
int arr[10];
wat(arr);
}
>>
>>108583691
it was a mistake for C to support [] in parameters as it's a like. It's just a pointer.
>>
File: screencapture-deepseek.png (68 KB, 770x1058)
68 KB
68 KB PNG
>>108583691
>>
>>108583691
C is a general-purpose programming language created in the 1970s by Dennis Ritchie.
>>
>>108583691
If you're asking why C doesn't store array size along with the pointer, it's because it evolved from B where everything was an integer and a pointer was just an integer that stored an address.
 sizeof 
is a compile-time macro, so it only gives you the array size when the compiler can resolve the array size..
>>
>>108583015
>>108582958
That's wrong. "char s[]" is an array. You can try it yourself. do "s[0] = 'b';" on both. with "char s[]" it will work, but for "char *s" it will crash the program because you try to write to read-only memory region.
>>
>>108583738
Ah, my bad, empty brackets are only a pointer in parameters. In local variable with initializer it's more like "infer size for me".



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.