[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 34 KB, 720x480, 1505029153317.jpg [View same] [iqdb] [saucenao] [google] [report]
62750602 No.62750602 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?

Old thread: >>62738069

>> No.62750649


>> No.62750666

from last thread

i have now following code in my makefile
CC = gcc
CFLAGS = -Wall -pedantic -std=iso9899:2011

foo: foo.o
$(CC) $(CFLAGS) foo.o -o foo

bar: bar.o
$(CC) $(CFLAGS) bar.o -o bar

foo.o: foo.c
$(CC) $(CFLAGS) -c foo.c

bar.o: bar.c
$(CC) $(CFLAGS) -c bar.c

but only foo gets an executable, for bar there is not even an object file created.
can anybody help?

>> No.62750674

Posting it again

Which book on compilers should I get?
I want some theory on parsers and lexers as well, no Yacc/Flex and ANTLR.
The classic Dragon Book, Engineering a Compiler by Cooper/Torczon or something else?

>> No.62750679


>> No.62750688

all: foo bar

Or something like that

>> No.62750835

fuck make satan

>> No.62750878

fuck opengl though

>> No.62751024


>> No.62751025

CFLAGS=-Wall -pedantic -std=iso9899:2011
all: foo bar
foo: foo.o
bar: bar.o

that is all

>> No.62751061

>that is all
how does this magic happen?
that is neat

>> No.62751093

Encrypted communications network in Erlang

I am so hard

>> No.62751108

what c book would you commend?

>> No.62751114

No good make alternatives sadly

>> No.62751117

have anything to share lad?
sounds fun

>> No.62751123

The GNU C reference manual

>> No.62751129


>> No.62751135
File: 30 KB, 540x551, 1500308923701.jpg [View same] [iqdb] [saucenao] [google] [report]

Sounds great. Would like to see something. I have to make an imitation models using OpenModelica.
And also have to comparce what tasks are easier to implement in Scala rather than Java. Have no idea.

>> No.62751137

The Go Programming Language. It's C evolved.

>> No.62751154

>install python in order to compile c
pls no

>> No.62751178

most linux based distros come with python preinstled tho

>> No.62751185

What the fuck are you using that doesnt have python be default

>> No.62751207
File: 36 KB, 511x509, 1463363949111.jpg [View same] [iqdb] [saucenao] [google] [report]

Employed Haskell programmer reporting in

>> No.62751224

I'll have a cheeseburger and a coke. Thanks!

>> No.62751235

Location? Only Haskell/Elixir jobs I can find are in shit valley

>> No.62751242

>his distro has bloat preinstalled

>> No.62751252

>he uses a """"distro""""

>> No.62751253

>installing make and shell in order to compile c
pls no

>> No.62751293

>not having shell, make and compiler in initramfs

>> No.62751297

>how does this magic happen?


>> No.62751309

>Installing a compiler to write high level C instead of pure asm
pls no

>> No.62751335

>installing a bloated assembler instead of writing pure hex

>> No.62751352

>codemonkey shit instead of being a manager

>> No.62751368

nothing substantial yet but the info I can give is that it'll be a WebRTC peer maker using perfect forward secrecy that connects two peers and makes sure they both form a direct p2p socket to each other using a strong cipher suite.
Will post some code soon. From the little I know from Scala actor models are easier done in Scala than java.
>she doesnt create her own with musl + gcc + mksh

>> No.62751369
File: 1.98 MB, 1542x897, Screenshot from 2017-10-04 15-24-47.png [View same] [iqdb] [saucenao] [google] [report]

I've been working on an app in the last few months which plots implicit surfaces. It's working pretty well now.


It uses the marching cubes algorithm to create the surface mesh, and I've implemented things like parallax mapping and triplanar mapping to texture the surface. How does it run for you?

>> No.62751376

>glorified baby sitter with no value or fulfillment in life anymore

>> No.62751403

There's no point in limiting your development environment.
Having python based build is good because you script it with actual scripting language.

>> No.62751431

protip: you don't need to """script it""", you just need to declare it

>> No.62751445

Many years ago i used to be good at delphi ( yes, i know), was starting to pick up C# but stopped leaning programming. I want to get back into it now but im on Linux, how's .net core on Linux? Also is golang good?

>> No.62751465

>.net core on Linux?
it's immature but generally fine, if you don't mind being locked into microsoft's build system
consider mono as an alternative

>> No.62751478

>implying people don't write 1000 line makefiles which end up including millions of bash scripts to build their shitty library

>> No.62751514

correct; people don't write 1000 line makefiles; they just cargo cult copy-paste someone else's autoconf script from the '70s

>> No.62751574

c++ will never be good, but a proper modules system would at least help stop every new file i have to create from coming with a creeping sense of dread and disgust, and i can't understand why they don't just do it already

>> No.62751581

design by committee

>> No.62751605

you should join the design committee, you obviously have this stuff figured out

>> No.62751735

I don't understand.

>> No.62751755
File: 1.45 MB, 1223x673, 12w3erftgh.png [View same] [iqdb] [saucenao] [google] [report]

pretty good i would say

>> No.62751863

>>> import re
>>> penis = re.compile(r'([!]{2,})|([?]{2,})')
>>> asshole = penis.sub(
... lambda match : '!' if match.group( 0 )[ 0 ] == '!' else '?',
... 'Sup!!!! Easter??????'
... )
>>> asshole
'Sup! Easter?'

>> No.62751920

Or alternatively
>>> penis = re.compile(r'([!]{2,})|([?]{2,})')
>>> def replacer( match ):
... matched_substring = match.group( 0 )
... if matched_substring.startswith( '!' ):
... return '!'
... else:
... return '?'
>>> asshole = penis.sub(
... replacer,
... 'Sup!!!! Easter??????'
... )
>>> asshole
'Sup! Easter?'

>> No.62751968

Thanks. I wanted to do this without a loop or if/else statements, like within the first argument of the .sub method.

>> No.62752037

>emoji in code on the official blog
what did they mean by this

>> No.62752065

supports unicode
or whatever

>> No.62752080

Trying to understand bitwise operators

I'm given this function that's supposed to find the midpoint of low and high:
char mid_B(char low, char high)
return ((unsigned char)low + (unsigned char)high) >> 1;

I worked out that mid_B(-120, -10) should give me 63, but when I run it through gcc, it gives me -65 (the correct answer).

My question is: Despite initially casting both chars to "unsigned", gcc appears to fill the right-shift with ones on the left. Here's my work:

mid_B(-120, -10). /* Should be -65, but am worried about sign extension in signed chars */

-120 in binary = 1000 1000
-10 binary = 1111 0110
0111 1110

Right shifting the answer:
(Assuming unsigned right shift, we padd the left with zeroes):
0111 1110 >> 1
0011 1111 => 0x3f = 63

But I guess C adds a one to the front?

>> No.62752111

I'm dumb, this should work too:
asshole = penis.sub(
lambda match : match.group( 0 )[ 0 ],
'Sup!!!! Easter??????'

>> No.62752116

anon who is trash at string manipulation here.
How do I go about making a loop that takes in a user inputted String, the user then tells me that they want to replace a single character in the String, and the program then finds that instance of the character and then replaces it with the character the user wants.

Example would be:
>replace 'g'
>second 'g' with 'r'

output: programming.

I have a for loop that allows me to replace all instances of a character but I can't exactly pinpoint how to replace a single instance without impacting the entire string.

I have an idea that I need to keep a variable that counts the instances of the character and I need to print out the new string based off of this data but I don't exactly know how to write that in java code.

>> No.62752172

It works, thanks.

>> No.62752235
File: 72 KB, 1588x793, c2.png [View same] [iqdb] [saucenao] [google] [report]

who better c here?

>> No.62752254

Assuming you are representing a String as an array of characters

char[] anon_function(char str_to_change[STR_LENGTH], char char_to_replace, char replacing_char, int location)
// declare an integer variable that keeps track of how many times you've
// seen "char_to_replace"

for(int ind = 0; ind < STR_LENGTH; ind++)
if(str_to_change [i] == char_to_replace)
if(location == {variable that's been keeping track of how many times you've seen a char })
str_to_change[i] = replacing_char
// increment counter

return str_to_change

You're on the right track

>> No.62752269

I'm actually confused... What's .the point of excluding #include if you're going to have packages anyway? Aren't they the same thing?

Or is it a really specific "Oh packages can let you take several functions but not the entire file " thing?

>> No.62752300

it may be an Obj-C-style #import instead, a little higher-level (didn't read it)

>> No.62752350

Header files are just included as is into the current file, that's why you usually use header guards.
I assume with those package you just write your C file but mark some functions public and you don't need separate header file.

>> No.62752461

See that's what i'd love to do but I can't use arrays in my assignment. I'm sure I can find a way to do that without arrays.

>> No.62752582

Should I pick up C++ again (my knowledge of it at this point is very rusty, I last used it about 10 years ago) or start with Rust?

>> No.62752600

Who cares, you are just going to shitpost on /g/ anyway.

>> No.62752635

>Also is golang good?
it's the only meme language in existence
the only reason people use it is that it's backed by Google (it does have a good concurrency model admittedly)

>> No.62752694

includes aren't namespaces

>> No.62752897

this hacking book is kinda outdated but it says you can use strcpy to overwrite the return value of a stack frame. does that still work?

>> No.62752900

I need some help with a compilation error I'm having:
Fraction.cpp:21:10: error: prototype for ‘Fraction Fraction::operator+(const Fraction&)’ does not match any in class ‘Fraction’
Fraction Fraction::operator + (const Fraction& toAdd) {
Fraction.h:20:20: error: candidate is: const Fraction Fraction::operator+(const Fraction&)
friend ostream& operator << (ostream&, const Fraction&);

in cpp file:
Fraction Fraction::operator + (const Fraction& toAdd) {
return this;

in header file
Fraction operator + (const Fraction&);

Headers look the signatures look the same to me maybe I have been looking at it for too long.

>> No.62752909

*not return value, i meant the saved pointer to the place where instruction flow should resume after the frame exits. not sure what to call it

>> No.62753013

If i'm doing separate object file compiling using g++ for example
$g++ -c -g -o foo.o foo.cpp
$g++ -c -g -o bar.o bar.cpp
$g++ -g -o foobar foo.o bar.o

if I want to change the foobar having -O3 flag instead of -g, then should I recompile all of the file with the new flag or I just need to run $g++ -O3 -o foobar foo.o bar.o
Notes: the foo.o and bar.o is compiled with -g flag

>> No.62753022

Just go to gen.lib.rus.ec and get all of them.

>> No.62753034

Writing a POSIX driver for the sel4 microkernel. I'll then create a distribution called gnu turd.

>> No.62753046

Forgot to include, function is called as such

while(fin >> fOne >> sign >> fTwo) {
if (sign == "+")
fOne + fTwo;

>> No.62753319
File: 246 KB, 1883x971, screenshot.40.png [View same] [iqdb] [saucenao] [google] [report]

After upgrading the translator script for blender I realized I have a bunch of little tools that could be merged into a toolkit for Blender, so I've started working on a personal blender plugin for it.

So far, the toolkit will have:
-saving bone names to file
-saving material names mapped to blender to file
-mass remove constraints from IK

>> No.62753328

How do I convert all radians onto a 0-pi scale? I.e:

9.42477796077 = 3 * pi = pi

-3.92699081699 = -5pi/4 = 3pi/4

>> No.62753349

You need to recompile from scratch. When you call g++ on object files it just passes them to the linker.

>> No.62753381

(2pi + (theta % (2 pi))) % 2pi

>> No.62753800

Say, how many lines would you need to create a program that took a point, a slope, and a distance. then proceeded to draw a line with that slope and length with the point as origin?

From scratch.

>> No.62753816

>a slope
reported for racism

>> No.62753819

about tree fiddy

>> No.62753827

in C++ how to have a pointer of their child on parents class??
for example:
struct parent
child * chd;
void setChild(child * in) {chd = in;}

struct child : public parent
int val;

Its always saying that child has not been declared.

>> No.62753863

is there a way to do this with python?
perl -e 'print "A" x20;'

ie from bash give an inline command and have it output the result?

>> No.62753908

i'd need more than just lines, friendo

>> No.62753945
File: 28 KB, 474x386, tumblr_inline_mx5yqh1jk01rlbp3x.jpg [View same] [iqdb] [saucenao] [google] [report]

Best languages to actually get a job?

>> No.62753984


>> No.62753993

The frame pointer. Yes, that attack would work against a poorly written function, assuming the information you can manipulate is on the stack, not the heap.

>> No.62754023

depends on the language and how you plan on drawing the line

>> No.62754032


>> No.62754044

In order:
everything else

>> No.62754057

webdev = js/python/php/sql

general/enterprise software/backend=c#/java


>> No.62754062


>> No.62754064

use character pointers instead of arrays? input the string from the user into a character pointer, then run a for loop going round until you come across the characters you want. each time the loop goes ground add 1 to the pointer to bump up the memory address to the next character in the string?

char *p=0
p = gets();

while (*p) {
//change the character
else {

>> No.62754077

I use C# and I actually have a job.
I make good money.

>> No.62754103

my professor is autistic and has a full page of potential deductions if our code does not exactly adhere to his preferences. one of them is this:
>Nameable values not in const or constexpr (-5%)
what does this even mean

>> No.62754129

Runt brain: dynamic types
Small brain: simple or polymorphic types
Large brain: dependent types that are logical propositions
Ascended brain: dependent types that aren't logical propositions

>> No.62754139

everything else

>> No.62754160

do u have a degree?

>> No.62754194


>> No.62754202

means he wants you to properly label variables that should be const.

>> No.62754212

There you go then

>> No.62754222

I know this is a CS 101 topic, but can anyone explain to me how alpha-beta pruning works? i get the concept behind it (deleting nodes that have the worse outcome than the previous nodes), but I am pretty clueless about the inner workings of it.

I assume this is the algorithm:

1. Compare the nodes of the deepest two subtrees of a node
2. If input value requests Minimum, delete the node with the largest value, else delete node with smallest value
3. Connect the smallest nodes of each subtree of the node, making them two new subtrees

I have absolutely no clue how to do step 3

>> No.62754231

>that aren't logical propositions

>> No.62754257

Totality is not guaranteed. This makes the language inconsistent as a logic since you can easily prove falsity with an abort or an infinite loop.

>> No.62754270

Fair enough. Depends on the market.

>> No.62754289

What's that supposed to mean?
A degree is a prerequisite for most decent programming jobs. Language isn't really relevant there.

>> No.62754410
File: 47 KB, 645x968, fuccmepapi.jpg [View same] [iqdb] [saucenao] [google] [report]

>Still haven't taken anything past trig yet in Uni
>Probably will be put in Pre-calc or Calc 1 next semester and want to prepare.
>Plan on spending break between semesters studying up on calc and algorithms

I'm a brainlet when it comes to some math so does anyone got some recommended math books or web seminars? I seem to grasp things better when they are explained by being applied to real life problems. I already looked at Khan academy and it seems to have a pretty decent course but if there's anything else to supplement it, that would really help.

>> No.62754429

Working on standard library for Solidity (Ethereum). Actually coming along quite nicely. https://github.com/ethereum/solidity-examples

Probably gonna be official by the end of the year or so. Probably gonna package it differently by then, but it'll stay in examples repo for now.

>> No.62754437
File: 243 KB, 640x480, onpu hot2.jpg [View same] [iqdb] [saucenao] [google] [report]

I spent all afternoon trying to roll my own lookAt and perspective matrix functions, and none of them work.
The descriptions of the algorithms in the old GLU documentation make no mention if the matrices are column or row major.
What does it mean in math notation when you have 2 vectors side by side like this?
F = centerX - eyeX centerY - eyeY centerZ - eyeZ
Let UP be the vector upX upY upZ .

Then normalize as follows:

f = F F
UP ″ = UP UP
Finally, let s = f × UP ″ , and u = s s × f .

M is then constructed as follows:

M = s 0 s 1 s 2 0 u 0 u 1 u 2 0 - f 0 - f 1 - f 2 0 0 0 0 1

>> No.62754477

do you actually make money doing this

>> No.62754693

well, not exactly bitcoin but i guess not that big of a difference. I don't make money from working on the library itself, that's a rather new project, but i do from related work. Been working for two companies doing blockchain-based PoVs for banks and insurance companies and such, probably gonna go into auditing now. That seems to be how people make money - either by working for big business, or startups funded by ICOs.

>> No.62754754

Why do most libraries have such garbage documentation?

>void getResult(int param1, bool param2)
>Gets the result using the values of param1 and param2.

>> No.62754762

you - calculator app! coming soon - fraction support
vs. the guy she told you not to worry about >>62751369

>> No.62754775

Semi-related. What's the best/lightest free android emulator for app developing atm?

>> No.62754785

is the google android simulator too shill for you?
how about test directly on machine?

>> No.62754793

That's just to keep consistency with other documentation. Maybe there's a function in which it isn't obvious how it works. However you don't want to leave holes and only document things you think the user won't understand. Bad practice.

>> No.62754803

>alpha-beta pruning
man, you are greatly over-estimating a typical CS1 course. usually it's :
what is a variable, conditionals, bubble sort, selection sort, this is what an object is, linked list

>> No.62754936

in the case of my lib it's because it hasn't been added yet (tho there are issues for it). Second reason in my case is because there's not a good system for documenting Solidity, so it will probably take some time before it could be considered good.

Most standards libraries has decent docs imo. This one will too.

>> No.62754991


struct child;

struct parent {
child* _child;
parent(child* in) : _child { in } {}

struct child : parent {
child() : parent(this) {}

>> No.62755005

>is the google android simulator too shill for you?
It's heavy and slow as fuck. I'm working on an i5 8Gb RAM laptop and I have to run Android Studio (which is heavy and slow) and server (Apache2 + MySQL via Vagrant on Virtual Box). Given, I also want to have a browser window open, I just don't have enough memory to run the built-in emulator and be able to work semi-efficiently.
I'm using Nox atm, it's great in the "lightweight" department, but doesn't seem to be well suited for development.
>how about test directly on machine?
Yeah, I'm doing that too.

>> No.62755029

> I just don't have enough memory
there you have it.
well there is bluestack and the likes.

>> No.62755047
File: 12 KB, 600x398, 1461809713534.jpg [View same] [iqdb] [saucenao] [google] [report]

Might as well repost here

Has anyone adopted Nim? I'm curious about learning it

>> No.62755083

>there you have it.
I don't that's the problem. I would haven't asked if I could solve the issue by using another machine, but I can't.

>> No.62755115

upgrade your ram
>inb4 soldered

>> No.62755152

Anon, are you an idiot? Serious question.

>> No.62755161

dont be so feisty ramlet

>> No.62755625

told you the other emulator: bluestacks and the likes

>> No.62755873
File: 1007 B, 157x248, 1492203506595.png [View same] [iqdb] [saucenao] [google] [report]

My C++ professor is going so fast I honestly have no idea how to keep up

We're covering topics such a sorting and searching within spans of days

Any online teachings that can help me grasp basic understanding of these fast before I get shoved into learning files next week

>> No.62755953

What's a good reference for learning how to write unit tests?

>> No.62755954

>GLU documentation make no mention if the matrices are column or row major
The bane of my existence. openGL doesn't either. I think I worked it out but can't remember which it was.

>> No.62755977

She looks like she took a big shit in her diaper and is now enjoy in the warmth of her own filth.

>> No.62756036

You mean algorithms or what?
I recommend writing and running code that does the things you talk about in class regardless.

>> No.62756097

Finally got defines/lambdas parsing correctly in my nascent Scheme implementation. It's nothing in the long run, but it always feels so good to get something you've been working on for a long time working.

Anyone else know that feel when your new project finally passes the 1k line mark? That feels great too.

>> No.62756120

>Java can't take primitive types as generic parameters
>You have to wrap it in wrapper classes like Integer
Holy fuck, what a shit language.
It doesn't even have type traits, lmao.

>> No.62756135

java should never have allowed primitive types
pure oop all the way

>> No.62756170

Yeah, I hate performance too.

>> No.62756226

it doesn't use templates so it needs to box args
makes perfect sense

>> No.62756227

no because im a mega-autist that can't stand seeing the var keyword

>> No.62756273

It at least lets you bound your generic parameters to implement certain interfaces and/or inherit a certain class.

>> No.62756275

>Java generics aren't compile time
Wow, what a shit language.

>> No.62756301

Only a retard would think this.
Templates are awful and should be relegated to a compiler optimisation technique.
Real generics are a great deal more flexible.

>> No.62756327

I think I've fucked myself. I've never had any projects I wanted to work on so have no personal projects to show employers and the only work experience is some web development I did as a favour to someone. Sure the web dev looks somewhat impression (Lead full stack developer) but I hate web development with a passion and want to go into lower level fields working with C. Those jobs however need a lot of experience and are rare as opposed to the shitload of C#/.NET/Java trash that is on every job search site.

What am I supposed to do? What projects can I do to make myself more appealing?

>> No.62756342

What kind of low level work do you want to do?
Drivers? Embedded systems?
Look for some open source project to contribute to. Github is a fine place to start.

>> No.62756367

I'm honestly not sure what specifically I want but yes drivers and embedded systems sounds interesting.

>Look for some open source project to contribute to
I don't think my confidence could let me put my code into someone else's without more personal groundwork but I'll check. Most github repos seem to just be for static hosting rather than for contributors to help though.

>> No.62756372

> Most github repos seem to just be for static hosting rather than for contributors to help though.
True, but it helps you get an idea of what's out there, and it's also useful for hosting personal projects that employers can view.

>> No.62756478

Templates can be instantiated to support higher rank polymorphism. Given a template function f<T> : T → T you can get g = ΛT. f<*T> : ∀T. *T → *T, which is allowed if *T has the same representation for all T. Or were you thinking of something else?

>> No.62756479

What is so interesting about making drivers or embedded systems work? That seems like the most boring type of work to do.

You made a driver compatibility with windows, woo

>> No.62756496

The driver I made was to control and interface with a robotic arm on an assembly line. There's more to drivers than just OS's and I enjoy writing fast and efficient C.

>> No.62756517

>dude just add a shitty macro system but add a special condition because i hate generics :^)

>> No.62756535
File: 57 KB, 1697x790, Screenshot from 2017-10-05 01:00:05.png [View same] [iqdb] [saucenao] [google] [report]

What am I doing wrong?It had loops with data types syntax from C99 giving me an error so I change things,it runs but it just leaves a blank.

It's obvious but I cant see it

>> No.62756554

You need to set i back to 0 probably.

>> No.62756561

This statement literally does nothing.
I'm surprised the compiler didn't complain about that.
This (>>62756554) too.

>> No.62756595

Who are you quoting? Do you think all template based generics work like they do in C++ where you have no type classes or traits, specialization is allowed and type checking is done after substitution?

>> No.62756682

I think you're a retard who holds insane opinions that they wouldn't hold when it comes to regular functions and would require languages to be more like C than they need to be, but thinks it makes him smart.

>> No.62756702

Can you provide evidence for "Real generics are a great deal more flexible." in the face of >>62756478, or are you just going to attack me?

>> No.62756709

Wow, still no arguments.
Your ideas are shit and you know it.

>> No.62756714

can someone explain to me what the hell *= means here
void square(int * pNumber) { // Function takes an int pointer (non-const)
cout << "In square(): " << pNumber << endl; // 0x22ff1c
*pNumber *= *pNumber; // Explicit de-referencing to get the value pointed-to

>> No.62756728

>alpha-beta pruning

>be me
>professor wants to make bot for invented board game
>have to use Prolog and alpha-beta pruning techniques
>write it once
>stack overflow
>rewrite it
>1 year to do anything
>fuck it
>now it reaches sonic speed but the code is unreadable, whatever
>make it compete against other bots
>it wins all the time
>reach finals
>lose because other bot forced a stalemate
>"what happened?"
>"when facing difficult decisions our bot makes a random choice instead of using any heuristics, it just works"

I will never not be mad.

>> No.62756730

It's shorthand for pNumber = pNumber * pNumber;

If it were a different variable it might be var1 *= var2 which would be the same as var1 = var1 * var2.

>> No.62756759

Arguments for what?

>> No.62756768

C was so comfy why do I have to use C++ ;_;

>> No.62756777

Yeah you totally weren't defending your stupid post, you were just arguing about some inane semantics which even then are false because it's still true regardless of if you want to be an autist about it. Demanding pointers is a reduction in complexity after all.

Keep your shitty macros to yourself

>> No.62756778

Why on earth would you "have" to use C++?

>> No.62756785
File: 16 KB, 250x250, 1503085454938.jpg [View same] [iqdb] [saucenao] [google] [report]

*not demanding pointers
also triple 7s

>> No.62756792
File: 110 KB, 657x539, 1506636096236.png [View same] [iqdb] [saucenao] [google] [report]


>> No.62756794

For a class project, I accidentally a few words

>> No.62756795

Library and documentation exist for C++ but not for C.

>> No.62756804

Are you legitimately retarded?

>> No.62756809

Vulkan for mah gayms

>> No.62756813

C is a subset of C++, remain comfy

>> No.62756820

Vulkan is a C API.
Nobody is retarded enough to write a library that people actually want to take seriously in anything other than C.

No it's not, dumbass.

>> No.62756824

I didn't ask you for a selfie you autist
Go back to /r9k/

>> No.62756832

Stay butthurt about minor syntax differences.

>> No.62756835

I don't mean in general. I mean for the case where your professor wants to use a certain flavor of OpenCV for the project.

>> No.62756837

Why are managed language faggots so insufferable?

>> No.62756862
File: 463 KB, 755x1069, ferris a cute!!.png [View same] [iqdb] [saucenao] [google] [report]

C++ doesn't allow
>compound literals
>anonymous structs or unions
>named members in initializer lists
>arbitrary array members in initializer lists
>implicit casts from void * pointer
>taking the address of an anonymous stack variable
>implicit narrowing conversions from double to float
I could go on.

>> No.62756903

C++ doesn't allow
>goes on to list a bunch of features that were mostly added to C after the C++ standard was released

>> No.62756914

All of them are standard C99.
None of them were added to C++98, 03, 11, or 17.

>> No.62756934

Okay, but why would they be?

>> No.62756938

C++ doesn't have standard restrict, either.

Doesn't matter.

>> No.62756939

You claimed that C is a subset of C++ when it's not.

>> No.62756968

>second one on the list

>> No.62756975

Which C? C99? C89? C11?

>> No.62756983

None of them.

>> No.62756998


>> No.62757020

Not really programming related but does anyone have a comma-spaced list of all video formats?

>> No.62757044

Of course it is. I was so focused on understanding pointers I forgot its also used for multiplication. Derp on my part but thats also poor form for an example in my defense.

>> No.62757126


>> No.62757246

None of the C standards or even pre-standard C is a subset of C++.

>> No.62757381

>compound literals
>anonymous structs or unions

C++ has these.

>> No.62757432

Why does programming make me so happy?

>> No.62757455

because nothing these does

>> No.62757490

>>compound literals
$ cat shit.cc
int main()
int a = (int){ 0 };
$ g++ shit.cc -std=c++17 -Wpedantic
shit.cc: In function ‘int main()’:
shit.cc:3:19: warning: ISO C++ forbids compound-literals [-Wpedantic]
int a = (int){ 0 };

>> No.62757556
File: 31 KB, 456x320, 1426858342702.jpg [View same] [iqdb] [saucenao] [google] [report]

how would I go about writing a function to convert from binary to decimal in c++?

>> No.62757567

I can convert by hand no problem but cant figure out how to write it in code

>> No.62757589

This is how you do it in C
int bin_to_dec(int n)
return n;

>> No.62757612
File: 35 KB, 600x885, 29e.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.62757696

You mean, you have a string of 0s and 1s as input or a variable of arithmetic type?

>> No.62757777

Is there a binary type in C?

>> No.62757782

Reading Nuklear source. Why the fuck someone thought providing an option to not depend on libc AND only use C89 AND only provide header-only implementation would be a good idea?

1/4 of this shit is buggy, non-compliant to the C standard, slower libc reimplementation, copied and pasted from the internet.
2nd 1/4 of this shit is fucking conversion functions. Because of lack of constant literals they provide like 7 ways to initialize a structure, then add more to convert shit (who the fuck needs hsv<->rgb conversion functions, both for floats and integers?).
3rd 1/4 of this shit is stb libraries embedded directly into the source (3 of them, maybe even more ffs).

Finally, only the last 1/4 of this code is actually doing something.

>> No.62757787

Anyone else think makefiles suck ass? How did this shit become the standard to build programs?

>> No.62757802

string of 1's and 0's , have to return int value

>> No.62757825

Think about how you translate 1 bit to an integer
then 2 bits
then n bits
Now you have your solution.

>> No.62757828

They work exceptionally well for simple programs.
But when you try to add a bunch of pointless complexity to the things you want to do at build time, they fall apart.

>> No.62757840

You will love cmake then.

>> No.62757841

>pointless complexity
like including fucking headers, lol

>> No.62757865

The C standard does not see arithmetic variables as a series of bits, but as values comprised within an interval of values, so you shouldn't infer on the encoding of those.
Nevertheless, the standard guarantees that char is encoded on CHAR_BITS bits.

>> No.62757885

Your C compiler can handle generating that shit.

>> No.62757898

That's not the job of the compiler. That's the job of the build system.

>> No.62757908

Are you suggesting that we need to have a C parser built into our build systems?

>> No.62757910

Makefiles are bloat.

>> No.62757913

No. A preprocessor will do.

>> No.62757922

Why write your own, when you can use the one that already exists in your C compiler?

>> No.62757962

Because then you would have to make a makefile parser.

>> No.62757974
File: 342 KB, 714x738, 1421164417027.png [View same] [iqdb] [saucenao] [google] [report]


>> No.62758025


int binary_to_decimal(string str){
unsigned x = 0;
for(char c : str){
x <<= 1;
if(c == '1'){
x = x | 1;
return x;

>> No.62758027

why does C++ have to be so shitty and inconsistent

>> No.62758054

GCC and clang are both already capable of spitting out "makefiles" with file dependency information, which you can 'include' in your makefile. They don't actually need to be able to parse makefiles.

>> No.62758061
File: 106 KB, 593x578, 1486170337578.jpg [View same] [iqdb] [saucenao] [google] [report]

>t. couldn't deal

>> No.62758085
File: 219 KB, 783x800, 132890480153.jpg [View same] [iqdb] [saucenao] [google] [report]

Do you ever just feel like ur a brainlet?

line_count = 0
for line in archived_file.readlines():
if line_count >= 27:
line_count += 1
if line_count > 400:

>> No.62758095
File: 55 KB, 657x527, 128704028121.png [View same] [iqdb] [saucenao] [google] [report]

as opposed to

archived_string = ''.join(archived_file.readlines()[26:400])

>> No.62758234

line_count = 401

>> No.62758248

It's irrelevant. It could be 600 or 300 and work fine.

Just need a large enough chunk of a document to search through

>> No.62758250

Skipping work so I dont have to program the companies internal database and resist the erge to walk into the street

>> No.62758317
File: 143 KB, 911x478, 92184921.jpg [View same] [iqdb] [saucenao] [google] [report]

To explain further, it's a uni project where we have to make a GUI and backend in python that extracts news from some site and archives it.

>> No.62758333

You don't even a need separate function to that.
std::accumulate(bin_num.rbegin(), bin_num.rend(), 0, [index = 0](int res, char c) mutable { return res |= (c - '0') << index++; });

You'll need C++14 though.

>> No.62758499

A separate function is more readable than this one line mess.

>> No.62758626

bin_num.iter().rev().enumerate().fold(0, |res, (idx, c)| res | ((c - b'u8') << idx));

>> No.62758634

Fair enough. If I properly formatted it, it would look better.

>> No.62758952

It's interesting that g++, clang++ and rustc are able to vectorize that simple code into advanced AVX magic: https://godbolt.org/g/HDhV1d , https://godbolt.org/g/nPLdqc , yet C- and Go-tards still claim generics are unnecessary for a system programming language.

>> No.62759334

>the sepples monkey thinks this is sane

>> No.62759348

how do i into computer graphics? having learned the basics of c++ i want to start doing stuff and demoscene like programs seemed like an interesting project to start with.
Should i start by diving deep into opengl,simpler things like SDL or the math of it all itself.

>> No.62759382

Agile is shit.

>Work in project with no general plan, just adding functionalities as clients talks about them
>After few months it comes out that everything needs to be restructured cause otherwise some things would be slow as hell
>Code is rather clean so refactoring isn't that much pain
>Database schema is totally fucked

What was so wrong about waterfall again?

>> No.62759467
File: 111 KB, 500x500, 1350594293765.jpg [View same] [iqdb] [saucenao] [google] [report]

The regex

matches everything between lesser than and greater than signs (including the signs themselves).

Which regex matches everything not in between lesser than and greater than signs?

>> No.62759480


You just tricked me into typing a retard smiley, didn't you?

>> No.62759488

>tfw feature-driven development is a positive thing in the agile world
Wow, I guess my project doesn't have shitty management, we're just AGILE. Too bad the code base is close to unmaintainable after 8 years in development.

>> No.62759499
File: 505 KB, 700x979, k6sded6b9mkz.png [View same] [iqdb] [saucenao] [google] [report]

You're not trying to parse xml/html with regexs, are you?

>> No.62759508
File: 3 KB, 252x137, asda.png [View same] [iqdb] [saucenao] [google] [report]

While that does look like a smiley, it does not work. The goal is to select " asd " and " " in this example.

No, I'm trying to figure out if something I parsed from pseudo-BBcode to HTML is empty or not. If it's empty, it'll only contain <span>s without any actual content other than whitespace in between the spans.

>> No.62759509

Anyone C# here?
Please help :3

Suppose i have function which takes

Action<IEnumerable<T>> parameters

How can i pass those parameters correctly using lambda expression? Tried everything and shit doesn't work

>> No.62759520

>While that does look like a smiley, it does not work. The goal is to select " asd " and " " in this example.
You suck at explaining.


>> No.62759525

Just use your local analog of http://php.net/manual/en/function.strip-tags.php .

>> No.62759531
File: 7 KB, 286x176, asda.png [View same] [iqdb] [saucenao] [google] [report]

Thank you for the attempt, but it still does not work.

Does JavaScript have anything like that?

>> No.62759539

>Thank you for the attempt, but it still does not work.
Just give me a link to your evaluator so I don't have to type regular expressions by heart.

>Does JavaScript have anything like that?
Most likely. Google is your friend.

>> No.62759548


>> No.62759553
File: 6 KB, 502x173, Capture.png [View same] [iqdb] [saucenao] [google] [report]

my last school project is a game in monogame.
build everything from scratch(obviously not including opengl and sound and input processing cause i'm still a noob) like UI and collision detection from scratch.
the whole UI is a mimic from windows form.
bloated af. pic related.

>> No.62759562


>> No.62759567


>> No.62759572

(>^.^<) # look it's a kitten

>> No.62759587


pls halp

>> No.62759593

It always imppresses me how compilers are usually able to see through layers and layers of code abstractions to do things like auto-vectorization and loop optimizations.

>> No.62759594
File: 44 KB, 1200x1200, owo.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.62759617
File: 440 KB, 1024x694, dafak.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.62759636
File: 206 KB, 1024x768, 1506132460425.jpg [View same] [iqdb] [saucenao] [google] [report]

I resorted to stripping the tags by using the regex I had already written, trimming the remainder and checking the length of what I had left after that. Thanks for the help! Now I won't have to make Las Vegas look like a fucking joke.

>> No.62759644

Not the person you were replying to but that regex evaluator looks like it's this: https://regex101.com/

>> No.62759659

Yeah, I found it also. Was just too lazy to evaluate, but then I got impatient and just googled it. But thanks anyway.

>> No.62759673

Why don't you read your textbook anon?

>> No.62759688

Suggest to me a small sized project that can be accomplished in a reasonable amount of time, namely 3-7 days, while being produced using the C programming language.

>> No.62759696

Something that prints a huge dick in your terminal.

>> No.62759709

I don't have one yet

>> No.62759718

Build a bot where you can type in your password and username, and it will down vote all comments on a subreddit that is chosen

>> No.62759735

a terminal water simulation like the 1 in IOCCC

>> No.62759747

That would require signing up to reddit.

>> No.62759782

sometimes a sacrifice must be made.

>> No.62760016
File: 753 KB, 500x750, 1506222907517.gif [View same] [iqdb] [saucenao] [google] [report]

>A.S Cert in Computer Programming is almost done
Thank fuck another check in the checkbox, all I got is internship credit left.

>> No.62760033

Why does a leading 0 mean octal base in C?

Like what is the point of this feature.

>> No.62760057

>Like what is the point of this feature.
Typing in numbers in octals so you don't have to use some shitty other base like 2,16 or god forbid 10.

>> No.62760063

So you can write octal easily and quickly? You can also prefix 0x to write in hex.

>> No.62760096

What is the function of header #include <new> ??
It's existed in some library documentation, and the page of the header in cppreference.com only telling that those header are for dynamic memory management, which already existed in basic C++.

>> No.62760116

> Like what is the point of this feature.
C is stuck in the 70s, and back then the octal base was popular for some reason. I personally use it like once a year for stuff like 0777 in chmod function.

>> No.62760124

>So you can write octal easily and quickly
When have you ever needed to do this?
>You can also prefix 0x to write in hex
o rly

>> No.62760137

>Why does a leading 0 mean octal base in C?
don't know
>Like what is the point of this feature
it was easier to express memory as an octal rather than a hexadecimal, especially in low memory systems.

>> No.62760150


C isn't for me, dummy. Being able to easily write in different bases is a good feature for a language that deals in lower level systems. 0x 0b and 0 are just a simple way to tell the compiler to do a conversion you as a programmer don't feel like doing. I also guarantee you don't use 80% or any programming language features.

>> No.62760163

char shellcode[]={
DWORD shellcode_size=0x20;
DWORD syscall_number_offset=0x0B;

void KillApp(DWORD pid)

char code[0x20];

HMODULE h=GetModuleHandle("NTDLL.DLL");
FARPROC p=GetProcAddress(h,"ZwTerminateProcess");

HANDLE hProc=0;

LPVOID hRemoteMem = VirtualAllocEx(hProc, NULL, 0x20, MEM_COMMIT, PAGE_EXECUTE_READWRITE);

DWORD numBytesWritten;
WriteProcessMemory(hProc, hRemoteMem, code, 0x20, &numBytesWritten);

HANDLE hRemoteThread = CreateRemoteThread(hProc, NULL, 0, (LPTHREAD_START_ROUTINE)hRemoteMem, 0, 0, NULL);

int main(int argc,char** argv)

printf("usage: %s <pid>\n\n",argv[0]);
return 0;
DWORD pid=atoi(argv[1]);

return 0;

I fucking hate c++.

>> No.62760191

We have octal literals in C because Unix started on PDP-7 and it had 18-bit words, which could be easily expressed as 6 octal digits but couldn't be expressed in hex because 18 % 4 != 0. There is literally no reason to have them in a language today since 18/36-bit systems died in the 70s.

>> No.62760211

If it isn't broken don't fix it.

>> No.62760213

Print a swastika of size N in the terminal.
The girth of the swastika must also grow so you can't have one big really thin swastika.

>> No.62760217


typedef NTSTATUS (_stdcall* zwOpenProcessPtr) ( ProcessHandle, NTSTATUS ExitStatus);

ZwOpenProcessPtr ZwOpenProcess = (ZwOpenProcessPtr) (GetProcAddress(h, "ZwOpenProcess");

This is the best way to get handles to NT* functions from NTDLL (looks nicer)

>> No.62760234
File: 28 KB, 1077x462, pointers.png [View same] [iqdb] [saucenao] [google] [report]

Whats a pointer?

>> No.62760256

A location in memory.

>> No.62760280

Octal and hexadecimal are nice because they directly translate to binary.

0 = 000
1 = 001
2 = 010
3 = 011
4 = 100
5 = 101
6 = 110
7 = 111

So you can quickly write bit patterns like: 707 for 111000111 or 451 for 100101001

Basically if you're doing evil bit level hacking. Although everyone these days uses hex instead which is the same thing but every digit represents 4 bits instead of 3.

>> No.62760350

Think a pointer as your house address, and your house as the item being referenced. Some stuff may require your address, such as mailing service, and some stuff may require how the house looks but the location and the house itself is not important such as someone making a painting of your house. In case someone want to modify your house, such as building maintenance then you need to give your address, and therefore pass by pointer. If someone want to make a compilation of neighborhood photo, then you just pass him your photo of your house, and therefore pass by value. But sometimes there is a function that only need the visual of the house, but need something deeper than the front of the house such as the floor plan of the house (the example in the computer will be a C-string), so you need to pass them your address for them to come and draw the floor plan

>> No.62760410

reformat it m8. really hard to read as a wall of text.

Think a pointer as your house address, and your house as the item being referenced.

> pass by pointer aka reference
Some stuff may require your address, such as mailing service, and some stuff may require how the house looks but the location and the house itself is not important such as someone making a painting of your house.

> pass by pointer aka reference to modify
In case someone want to modify your house, such as building maintenance then you need to give your address, and therefore pass by pointer.

>pass by value
If someone want to make a compilation of neighborhood photo, then you just pass him your photo of your house, and therefore pass by value.

> pass by pointer aka reference
But sometimes there is a function that only need the visual of the house, but need something deeper than the front of the house such as the floor plan of the house (the example in the computer will be a C-string), so you need to pass them your address for them to come and draw the floor plan.

looking back, the analogy is kind of confusing.

>> No.62760412

>evil bit level hacking
I agree that you should avoid magic numbers in your code, but don't make some numbers more magical than others.
Nothing evil about octal

>> No.62760420
File: 26 KB, 626x626, worker-with-doubts_1012-193.jpg [View same] [iqdb] [saucenao] [google] [report]

Would you accept an unpaid internship? (finishing Master's in Software Engineering)

(I'm in Europe)

In college, i talked to a professor who had an internship but it is unpaid, and I'm going to have to pay for student loans in the period I'm doing it
(around 600 euros) and i don't have that kind of money, cause my parent always paid the loans.

The thing is, i said to the professor i would take his internship. But my college will open another internships that could be paid.

what would you guys do?


>> No.62760434

Hey, /g/ What is the best way of storing some text entry in C++?
I have a project that require to store a list of names in a text file. Currently the program is using plain text file formatted with \n as the separator between names. But I guess that is not the best way to store data.
What is the better way to store something like that? What format should I use?
Note: my prediction of the total amount of the name will be around 100 to 200, and the name length no more than 20 chars

>> No.62760446

json? ini? csv?

>> No.62760466

Is there a "proper" way of including libraries in Visual Studio C/C++ projects? Seems a little clunky digging through project properties and adding all the include and library directories and files manually.

>> No.62760470

>storing some text entry in C++
dude you can't. It's fucking unusable. It's even miracle it compiles. You can't do anything with sepples.

>> No.62760477

Do you have any experience in the field? asking this because a friend told me that in europe is common for undergrads go straight to masters.

>> No.62760491

>Do you have any experience in the field?
Yes i have some, but does it matter?

I'm already finishing master's though

>> No.62760500

Get the stick out of your bum bro.

>> No.62760505

working as designed

>> No.62760526

>the #include directive basically issues a copy-and-paste operation to the C preprocessor, inherited by C++ without changes

Are they implying that C invented #include? Include has been an assembler directive that operates exactly the same way it does in C and C++ since literally the first assembler was written.

>> No.62760550

reading comprehension problem?
C++ inherited "#include" from C preprocessor.
nowhere in that sentence says that C invented #include.

>> No.62760553

>Yes i have some, but does it matter?
yes it matter, usually unpaid internships are for people that want experience in the field. In my opinion it's better to take a good unpaid internship and help create something stimulating than take the easy route an get paid to write CRUD: The application.

>> No.62760558

Reading comprehension problem? Inherited is a stupid word to use there.

>> No.62760586

so what word should it be then?
sincerely asking.

>> No.62760588

so i'll have to get the money somehow

maybe a job in the summer

>> No.62760607

It's literally the perfect word to use.

>> No.62760621


>> No.62760634
File: 9 KB, 162x124, gophercomplex1.jpg [View same] [iqdb] [saucenao] [google] [report]

Hey folks I want to learn concurrency, any good recommendations?

>> No.62760642

file permissions

>> No.62760648


>> No.62760667

I wouldn't agree with Python at the top of the list. Putting it above any of the other three is being disingenuous unless you're targeting a specific field.

>> No.62760680


>> No.62760703

>Would you accept an unpaid internship?
No, no, no, no, absolutely not.

Doing an unpaid internship literally hurts your career, statistically speaking. You've told the world that you are so useless that you accept zero compensation for your work.

>> No.62760749

thanks for the response

would you have the balls to go tho the professor and tell him that "i don't want your internship no more"?

>> No.62760763

>if you are good at something, never do it for free

that is the point of salary negotiation. you evaluate yourself by that much $ from that amount of work.
respect yourself and other will respect you

>> No.62760791

Absolutely, and I'd explain my issues with the arrangement. Again, statistically, you're better off not taking an internship over taking an unpaid internship. However, this might be attributed to the negative qualities of the kind of timid person who would accept an unpaid internship.

>> No.62760815


i'm going to tell him.

>> No.62761055

Does C have a good package manager yet?

>> No.62761071

Autotools is all you need.

>> No.62761241

New thread:


>> No.62761310

store them in arrays of strings by using a multidimensional character array.??

>> No.62761656

the ISO C11 standard doc

>> No.62761657

Serious questions guy.

I'm already average with C++ but I want to do programming a little more seriously.

Now I have an idea of a fun project, there's a san andreas multiplayer server that has an in-game stock market, I used to play there many years ago and checked it again yesterday - it got improved a lot. This stock market is influenced by game activity, the server has a wide arrangement of activities, business etc - the stock market is very alive.

Now I can obviously read a lot of data from memory so I can get all the data I need basically to perform this:

I want to make an auto trade platform, a lot of elements of it are simple and I can figure out how to do - like if player with job x stays idle for some time and another player stays idle next to him there's a high change he's buying products from him so the bot should consider to sell the stocks to rise price and so on.

But I want you guys who played with it to suggest me data or open source algorithms to read for: data collection, manipulation and so on and of course trading algorithms, until the end of the year I want to make it really complex and try everything just to learn it. I would really appreciate the help.

>> No.62762168

I go to 'online coding school' and I'm working on a Ruby CLI project, but I'm pretty new, if anyone is willing to look at it... I'm scraping movie lists by genre, rating, name... that's the main idea

>> No.62762761

I forgot C pointer syntax
What does this do?

*((int *)

Dereferences what?

>> No.62762805


it casts void* ptr to int* ptr and then dereferences it

im stupid

>> No.62762883

what's wrong with (2pi+theta)%2pi?

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.